Currently optional provides optimized storage for scalar types: https://github.com/boostorg/optional/blob/develop/include/boost/optional/optional.hpp#L900 Generalize it for any trivial type that is move/copy constructible/assignable, as per description in https://www.boost.org/doc/libs/1_80_0/libs/optional/doc/html/boost_optional/tutorial/gotchas/moved_from__optional_.html