2 // (C) Copyright Tobias Schwinger
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).
7 //------------------------------------------------------------------------------
9 // Metafunction to compute optimal parameter type for argument forwarding.
11 // This header is not an FT example in itself -- it's used by some of them to
12 // optimize argument forwarding.
14 // For more details see 'fast_mem_fn.hpp' in this directory or the documentation
15 // of the CallTraits utility [1].
21 // [1] http://www.boost.org/libs/utility/call_traits.htm
23 #ifndef BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED
24 #define BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED
26 #include <boost/config.hpp>
28 #include <boost/type_traits/add_const.hpp>
29 #include <boost/type_traits/add_reference.hpp>
31 #include <boost/mpl/eval_if.hpp>
32 #include <boost/mpl/identity.hpp>
34 #include <boost/mpl/aux_/lambda_support.hpp>
35 // #include <boost/type_traits/detail/template_arity_spec.hpp>
40 namespace mpl = boost::mpl;
44 namespace param_type_detail
49 typedef by_ref_cond type;
50 BOOST_STATIC_CONSTANT(bool,value = sizeof(void*) < sizeof(T));
54 struct add_ref_to_const
55 : boost::add_reference< typename boost::add_const<T>::type >
61 : mpl::eval_if< param_type_detail::by_ref_cond<T>
62 , param_type_detail::add_ref_to_const<T>, mpl::identity<T> >
64 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,param_type,(T))
67 // BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,utility::param_type)