Boost C++ Libraries: Ticket #13208: Make boost::optional<T> trivially destructible, copyable and movable if T is https://svn.boost.org/trac10/ticket/13208 <p> Conceptually there's nothing preventing <code>boost::optional&lt;T&gt;</code> from being trivially destructible, copyable and movable if T is. This could be useful, for instance, to use an <code>boost::optional&lt;T&gt;</code> as a union-member. </p> <p> I have a POC implementation based on Boost 1.64 <a class="ext-link" href="https://github.com/z33ky/trivial_optional/blob/master/optional.hpp"><span class="icon">​</span>here</a>. <br /> I moved <code>m_storage</code> and <code>m_initialized</code> to a new <code>class optional_storage</code>, representing the new base class. Some methods managing those members are move there as well. <code>optional_base</code> indirectly inherits from <code>optional_storage</code> through <code>optional_destroyer</code>, <code>optional_mover</code> and <code>optional_copier</code>, which are templated classes including a boolean parameter to determine whether <code>T</code> is trivially destructible, movable and copyable and use template specialization to provide the respective trivial members. <br /> The implementation relies on defaulting constructors, so without C++11 or newer only trivial destruction is possible. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13208 Trac 1.4.3