Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/mpl/if.hpp>
- #include <boost/mpl/not.hpp>
- #include <boost/mpl/or.hpp>
- #include <boost/type_traits/is_const.hpp>
- #include <boost/type_traits/is_reference.hpp>
- #include <boost/type_traits/remove_reference.hpp>
- namespace Impl
- {
- using namespace boost;
- //! Evaluates to true if T has move semantics inside forwarding function.
- template< class T >
- struct is_rr
- : mpl::not_< mpl::or_< is_reference< T >, is_const< typename remove_reference< T >::type > > >
- {
- };
- template< class U, class T >
- struct move_if_rr_helper
- : mpl::if_< is_rr< U >, typename remove_reference< T >::type &&, T & >
- {
- };
- }
- //! Moves rr if U && has move semantics inside forwarding function.
- template< class U, class T >
- inline typename Impl::move_if_rr_helper< U, T >::type move_if_rr( T &&rr )
- {
- return static_cast< typename Impl::move_if_rr_helper< U, T >::type >( rr );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement