Boost C++ Libraries: Ticket #6577: Add meta-function to extract the raw type, meta-function to compare raw types https://svn.boost.org/trac10/ticket/6577 <p> Based on the work I did on change-set <a class="changeset" href="https://svn.boost.org/trac10/changeset/77046" title="Fixed (hopefully) conflict between boost::base_from_member's C++11 ...">[77046]</a>, can we add my two type-traits to the general library? </p> <p> The first one extracts the raw type, that removes the top-level reference, const, and/or volatile qualifiers from a type expression. You need the raw type if you want to make a new object and/or apply your own transformations. </p> <pre class="wiki">template &lt; typename T &gt; struct remove_cv_ref { typedef typename ::boost::remove_cv&lt; typename ::boost::remove_reference&lt; typename ::boost::remove_cv&lt;T&gt;::type&gt;::type&gt;::type type; }; </pre><p> Unlike my patch code, the version here can handle "T const &amp; volatile". (I don't think automatic code can add a cv-qualifier after a reference, that's why I didn't have it. We have to be more general here.) </p> <p> The second trait would work like is_same, but compare the raw types. </p> <pre class="wiki">template &lt; typename T, typename U &gt; struct is_related : public ::boost::is_same&lt; typename ::boost::detail::remove_cv_ref&lt;T&gt;::type, typename ::boost::detail::remove_cv_ref&lt;U&gt;::type &gt; {}; </pre><p> Like the guy I got the idea from, you could use a template alias to implement this in C++2011. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6577 Trac 1.4.3 John Maddock Thu, 02 Aug 2018 10:54:45 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6577#comment:1 https://svn.boost.org/trac10/ticket/6577#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">obsolete</span> </li> </ul> <p> Remove_cv_ref is now in the lib. </p> Ticket