Re: [Boost-bugs] [Boost C++ Libraries] #5795: is_rvalue_reference returns wrong result when rvalue reference to a function is passed

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5795: is_rvalue_reference returns wrong result when rvalue reference to a function is passed
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-20 17:41:34


#5795: is_rvalue_reference returns wrong result when rvalue reference to a
function is passed
--------------------------------+-------------------------------------------
  Reporter: sscrisk@… | Owner: johnmaddock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: type_traits
   Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+-------------------------------------------

Comment (by iorate <iorate_stage@…>):

 Partial specilizations help solve the problem.

 For example, the following additional header works well.

 is_rvalue_reference_patch.hpp (please place this file in the include
 paths)
 {{{
 #ifndef BOOST_PP_IS_ITERATING


     #ifndef IS_RVALUE_REFERENCE_PATCH_HPP
     #define IS_RVALUE_REFERENCE_PATCH_HPP


     #include <boost/mpl/bool.hpp>
     #include <boost/preprocessor/iteration/iterate.hpp>
     #include <boost/preprocessor/punctuation/comma_if.hpp>
     #include <boost/preprocessor/repetition/enum_params.hpp>
     #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
     #include <boost/type_traits/is_rvalue_reference.hpp>


     namespace boost {


         #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 25,
 "is_rvalue_reference_patch.hpp"))
         #include BOOST_PP_ITERATE()


     } // namespace boost


     #endif // IS_RVALUE_REFERENCE_PATCH_HPP


 #else


     #define n BOOST_PP_ITERATION()


         template <class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class A)>
         struct is_rvalue_reference<R (&&)(BOOST_PP_ENUM_PARAMS(n, A))>
           : boost::mpl::true_
         {};

         template <class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class A)>
         struct is_rvalue_reference<R (&&)(BOOST_PP_ENUM_PARAMS(n, A)
 BOOST_PP_COMMA_IF(n) ...)>
           : boost::mpl::true_
         {};


     #undef n


 #endif
 }}}
 test.cpp
 {{{
 #include <boost/static_assert.hpp>
 #include <boost/type_traits/is_rvalue_reference.hpp>
 #include "./is_rvalue_reference_patch.hpp"


 BOOST_STATIC_ASSERT((boost::is_rvalue_reference<int (&&)(int)>::value));
 BOOST_STATIC_ASSERT((boost::is_rvalue_reference<int (&&)(int,
 ...)>::value));
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5795#comment:2>
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:07 UTC