Is the following legal?
template< typename T >
struct tree_node
{
T t;
std::vector children;
};
A commen
Actually, as a result of N4371 we have (from N4527, [vector.overview], will be in C++17):
An incomplete type
Tmay be used when instantiating vector if the allocator satisfies the allocator completeness requirements 17.6.3.5.1.Tshall be complete before any member of the resulting specialization of vector is referenced.
Prior to this, vector could not be constructed with an incomplete type (which tree_node is at that point), and that would be undefined behavior.