#include <iostream>
struct MyStruct
{
int mA;
int mB;
double mC;
MyStruct() : mA(1), mB(2), mC(3.3) {};
};
int main()
{
MyStruct myStruct;
auto [a, b, c] = myStruct;
std::cout << a << " " << b << " " << c << std::endl;
return 0;
}
// Output: 1 2 3.3
References:https://en.wikipedia.org/wiki/C%2B%2B17
https://skebanga.github.io/structured-bindings/
No comments:
Post a Comment