看到很多std::tuple的资料,但用起来很不方便,不能像python那样随心所欲。看到一个新的方法, 直接用中括号解包记录一下,c++17编译通过
#include#include std::tuple fun(float c) { float b = std::sin(c); int a = (int)(b * 10); return std::make_tuple(a, b); } int main() { auto [a, b] = fun(1.2); std::cout<< a << " " << b << std::endl; }



