If all of the members of std::tuple
are of standard layout types, is that std::tuple
itself standard layout? The presence of a user-defined copy-constr
No, standard layout requires that all nonstatic data members belong to either one base subobject or directly to the most derived type, and typical implementations of std::tuple
implement one member per base class.
Because a member-declaration cannot be a pack expansion, in light of the above requirement, a standard layout tuple
cannot have more than one member. An implementation could still sidestep the issue by storing all the tuple
"members" inside one char[]
, and obtaining the object references by reinterpret_cast
. A metaprogram would have to generate the class layout. Special member functions would have to be reimplemented. It would be quite a pain.