id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13208,"Make boost::optional trivially destructible, copyable and movable if T is",1zeeky@…,Fernando Cacciola,"Conceptually there's nothing preventing {{{boost::optional}}} from being trivially destructible, copyable and movable if T is. This could be useful, for instance, to use an {{{boost::optional}}} as a union-member. I have a POC implementation based on Boost 1.64 [https://github.com/z33ky/trivial_optional/blob/master/optional.hpp here]. \\ I moved {{{m_storage}}} and {{{m_initialized}}} to a new {{{class optional_storage}}}, representing the new base class. Some methods managing those members are move there as well. {{{optional_base}}} indirectly inherits from {{{optional_storage}}} through {{{optional_destroyer}}}, {{{optional_mover}}} and {{{optional_copier}}}, which are templated classes including a boolean parameter to determine whether {{{T}}} is trivially destructible, movable and copyable and use template specialization to provide the respective trivial members. \\ The implementation relies on defaulting constructors, so without C++11 or newer only trivial destruction is possible.",Feature Requests,new,To Be Determined,optional,,Not Applicable,,,