Smart pointers cannot be members of unions due to smart pointers having non-trivial copy constructors. Obviously there is no reason for this restriction to exist since all of the algebraic data types are tagged. Consider moving from unions to something more like std::variant or boost::variant to allow this use case.
Smart pointers cannot be members of unions due to smart pointers having non-trivial copy constructors. Obviously there is no reason for this restriction to exist since all of the algebraic data types are tagged. Consider moving from unions to something more like std::variant or boost::variant to allow this use case.