Re: [Boost-bugs] [Boost C++ Libraries] #9913: boost::has_complement of enum class does not compile

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9913: boost::has_complement of enum class does not compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-04-23 15:51:28


#9913: boost::has_complement of enum class does not compile
------------------------------------+-------------------------
  Reporter: Nevin Liber <nevin@…> | Owner: bronf
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: type_traits
   Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------+-------------------------

Comment (by Nevin Liber <nevin@…>):

 Here is my C++11 only version of has_complement:


 {{{
     namespace detail
     {
         namespace has_complement_impl
         {
             struct dont_care {};

             template<typename Rhs, typename Ret>
             class has_complement_trait
             {
                 template<typename Hs,
                          typename Et = decltype(~std::declval<Hs>()),
                          typename = typename
 std::enable_if<std::is_same<dont_care, Ret>::value ||
 std::is_convertible<Et, Ret>::value>::type>
                 static true_type has_complement_operator(int);

                 template<typename>
                 static false_type has_complement_operator(...);

             public:
                 using type = decltype(has_complement_operator<Rhs>(0));
             };
         }; // has_complement_impl namespace
     } // detail namespace

     template<typename Rhs, typename Ret =
 detail::has_complement_impl::dont_care>
     struct has_complement
     : detail::has_complement_impl::has_complement_trait<Rhs, Ret>::type
     {};

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9913#comment:4>
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:16 UTC