]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_erasure/include/boost/type_erasure/rebind_any.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / type_erasure / include / boost / type_erasure / rebind_any.hpp
CommitLineData
7c673cae
FG
1// Boost.TypeErasure library
2//
3// Copyright 2011 Steven Watanabe
4//
5// Distributed under the Boost Software License Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// $Id$
10
11#ifndef BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED
12#define BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED
13
14#include <boost/mpl/if.hpp>
15#include <boost/type_traits/remove_cv.hpp>
16#include <boost/type_traits/remove_reference.hpp>
17#include <boost/type_erasure/is_placeholder.hpp>
18#include <boost/type_erasure/concept_of.hpp>
19
20namespace boost {
21namespace type_erasure {
22
23template<class Concept, class T>
24class any;
25
26/**
27 * A metafunction that changes the @ref placeholder of
28 * an @ref any. If @c T is not a placeholder,
29 * returns @c T unchanged. This class is intended
30 * to be used in @ref concept_interface to deduce
31 * the argument types from the arguments of the concept.
32 *
33 * @pre Any must be a specialization of @ref any or a base
34 * class of such a specialization.
35 *
36 * \code
37 * rebind_any<any<Concept>, _a>::type -> any<Concept, _a>
38 * rebind_any<any<Concept>, _b&>::type -> any<Concept, _b&>
39 * rebind_any<any<Concept>, int>::type -> int
40 * \endcode
41 *
42 * @see derived, as_param
43 */
44template<class Any, class T>
45struct rebind_any
46{
47#ifdef BOOST_TYPE_ERASURE_DOXYGEN
48 typedef detail::unspecified type;
49#else
50 typedef typename ::boost::mpl::if_<
51 ::boost::type_erasure::is_placeholder<
52 typename ::boost::remove_cv<
53 typename ::boost::remove_reference<T>::type
54 >::type
55 >,
56 ::boost::type_erasure::any<
57 typename ::boost::type_erasure::concept_of<Any>::type,
58 T
59 >,
60 T
61 >::type type;
62#endif
63};
64
65}
66}
67
68#endif