#include <iostream>
#include <tuple>
int main()
{
std::tuple<int, double, int, double> myTuple{1, 2.2, 3, 4.4};
auto [a, b, c, d] = myTuple;
std::cout << a << " "; // 1
std::cout << b << " "; // 2.0
std::cout << c << " "; // 3
std::cout << d << " "; // 4.0
std::cout << std::endl;
return 0;
}
// Output: 1 2.2 3 4.4
References:http://en.cppreference.com/w/cpp/language/structured_binding
http://en.cppreference.com/w/cpp/utility/tuple
No comments:
Post a Comment