Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:10:14

0001 // Boost.TypeErasure library
0002 //
0003 // Copyright 2011 Steven Watanabe
0004 //
0005 // Distributed under the Boost Software License Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // $Id$
0010 
0011 #ifndef BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED
0012 #define BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED
0013 
0014 #include <boost/mpl/if.hpp>
0015 #include <boost/type_traits/remove_cv.hpp>
0016 #include <boost/type_traits/remove_reference.hpp>
0017 #include <boost/type_erasure/is_placeholder.hpp>
0018 #include <boost/type_erasure/concept_of.hpp>
0019 
0020 namespace boost {
0021 namespace type_erasure {
0022 
0023 #ifndef BOOST_TYPE_ERASURE_DOXYGEN
0024 template<class Concept, class T>
0025 class any;
0026 #endif
0027 
0028 /**
0029  * A metafunction that changes the @ref placeholder of
0030  * an @ref any.  If @c T is not a placeholder,
0031  * returns @c T unchanged.  This class is intended
0032  * to be used in @ref concept_interface to deduce
0033  * the argument types from the arguments of the concept.
0034  *
0035  * @pre Any must be a specialization of @ref any or a base
0036  *      class of such a specialization.
0037  *
0038  * \code
0039  * rebind_any<any<Concept>, _a>::type -> any<Concept, _a>
0040  * rebind_any<any<Concept>, _b&>::type -> any<Concept, _b&>
0041  * rebind_any<any<Concept>, _c&&>::type -> any<Concept, _c&&>
0042  * rebind_any<any<Concept>, int>::type -> int
0043  * \endcode
0044  *
0045  * @see derived, as_param
0046  */
0047 template<class Any, class T>
0048 struct rebind_any
0049 {
0050 #ifdef BOOST_TYPE_ERASURE_DOXYGEN
0051     typedef detail::unspecified type;
0052 #else
0053     typedef typename ::boost::mpl::if_<
0054         ::boost::type_erasure::is_placeholder<
0055             typename ::boost::remove_cv<
0056                 typename ::boost::remove_reference<T>::type
0057             >::type
0058         >,
0059         ::boost::type_erasure::any<
0060             typename ::boost::type_erasure::concept_of<Any>::type,
0061             T
0062         >,
0063         T
0064     >::type type;
0065 #endif
0066 };
0067 
0068 #ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
0069 
0070 template<class Any, class T>
0071 using rebind_any_t = typename ::boost::type_erasure::rebind_any<Any, T>::type;
0072 
0073 #endif
0074 
0075 }
0076 }
0077 
0078 #endif