C++ reference member variable initialization
어렵다, 어려워.
struct Obj1 {
int m;
int& ref = m; // Ok
};
struct Obj2 {
int m;
int& ref{m}; // Ok
};
/*
struct Obj3 {
int m;
int& ref(m); // Error
};
*/
struct Obj4 {
int m;
int& ref;
Obj4() : ref{m} {} // Ok
};
struct Obj5 {
int m;
int& ref;
Obj5() : ref(m) {} // Ok
};