[Boost-bugs] [Boost C++ Libraries] #6577: Add meta-function to extract the raw type, meta-function to compare raw types

Subject: [Boost-bugs] [Boost C++ Libraries] #6577: Add meta-function to extract the raw type, meta-function to compare raw types
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-18 18:41:32


#6577: Add meta-function to extract the raw type, meta-function to compare raw
types
-------------------------------------+--------------------------------------
 Reporter: dlwalker | Owner: johnmaddock
     Type: Feature Requests | Status: new
Milestone: Boost 1.50.0 | Component: type_traits
  Version: Boost Development Trunk | Severity: Not Applicable
 Keywords: |
-------------------------------------+--------------------------------------
 Based on the work I did on change-set [77046], can we add my two type-
 traits to the general library?

 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.

 {{{
 template < typename T >
 struct remove_cv_ref
 {
     typedef typename ::boost::remove_cv<
      typename ::boost::remove_reference<
      typename ::boost::remove_cv<T>::type>::type>::type type;
 };
 }}}

 Unlike my patch code, the version here can handle "T const & 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.)

 The second trait would work like is_same, but compare the raw types.

 {{{
 template < typename T, typename U >
 struct is_related
     : public ::boost::is_same<
      typename ::boost::detail::remove_cv_ref<T>::type,
      typename ::boost::detail::remove_cv_ref<U>::type >
 {};
 }}}

 Like the guy I got the idea from, you could use a template alias to
 implement this in C++2011.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6577>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC