]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_erasure/include/boost/type_erasure/deduced.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / type_erasure / include / boost / type_erasure / deduced.hpp
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_DEDUCED_HPP_INCLUDED
12 #define BOOST_TYPE_ERASURE_DEDUCED_HPP_INCLUDED
13
14 #include <boost/mpl/eval_if.hpp>
15 #include <boost/mpl/identity.hpp>
16 #include <boost/mpl/set.hpp>
17 #include <boost/mpl/empty.hpp>
18 #include <boost/type_erasure/detail/get_placeholders.hpp>
19 #include <boost/type_erasure/placeholder.hpp>
20
21 namespace boost {
22 namespace type_erasure {
23
24 /**
25 * A placeholder for an associated type. The type corresponding
26 * to this placeholder is deduced by substituting placeholders
27 * in the arguments of the metafunction and then evaluating it.
28 *
29 * When using @ref deduced in a template context, if it is possible for
30 * Metafunction to contain no placeholders at all, use the nested type,
31 * to automatically evaluate it early as needed.
32 */
33 template<class Metafunction>
34 struct deduced : ::boost::type_erasure::placeholder
35 {
36 typedef typename ::boost::mpl::eval_if<
37 ::boost::mpl::empty<
38 typename ::boost::type_erasure::detail::get_placeholders<
39 Metafunction,
40 ::boost::mpl::set0<>
41 >::type
42 >,
43 Metafunction,
44 ::boost::mpl::identity<
45 ::boost::type_erasure::deduced<Metafunction>
46 >
47 >::type type;
48 };
49
50 }
51 }
52
53 #endif