]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/function_types/example/detail/param_type.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / function_types / example / detail / param_type.hpp
1
2 // (C) Copyright Tobias Schwinger
3 //
4 // Use modification and distribution are subject to the boost Software License,
5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
6
7 //------------------------------------------------------------------------------
8
9 // Metafunction to compute optimal parameter type for argument forwarding.
10
11 // This header is not an FT example in itself -- it's used by some of them to
12 // optimize argument forwarding.
13 //
14 // For more details see 'fast_mem_fn.hpp' in this directory or the documentation
15 // of the CallTraits utility [1].
16 //
17 //
18 // References
19 // ==========
20 //
21 // [1] http://www.boost.org/libs/utility/call_traits.htm
22
23 #ifndef BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED
24 #define BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED
25
26 #include <boost/config.hpp>
27
28 #include <boost/type_traits/add_const.hpp>
29 #include <boost/type_traits/add_reference.hpp>
30
31 #include <boost/mpl/eval_if.hpp>
32 #include <boost/mpl/identity.hpp>
33
34 #include <boost/mpl/aux_/lambda_support.hpp>
35 // #include <boost/type_traits/detail/template_arity_spec.hpp>
36
37 // namespace boost
38 namespace example
39 {
40 namespace mpl = boost::mpl;
41
42 // namespace utility
43 // {
44 namespace param_type_detail
45 {
46 template<typename T>
47 struct by_ref_cond
48 {
49 typedef by_ref_cond type;
50 BOOST_STATIC_CONSTANT(bool,value = sizeof(void*) < sizeof(T));
51 };
52
53 template<typename T>
54 struct add_ref_to_const
55 : boost::add_reference< typename boost::add_const<T>::type >
56 { };
57 }
58
59 template<typename T>
60 struct param_type
61 : mpl::eval_if< param_type_detail::by_ref_cond<T>
62 , param_type_detail::add_ref_to_const<T>, mpl::identity<T> >
63 {
64 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,param_type,(T))
65 };
66 // }
67 // BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,utility::param_type)
68 }
69
70 #endif
71