// (C) Copyright Tobias Schwinger // // Use modification and distribution are subject to the boost Software License, // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). //------------------------------------------------------------------------------ // Metafunction to compute optimal parameter type for argument forwarding. // This header is not an FT example in itself -- it's used by some of them to // optimize argument forwarding. // // For more details see 'fast_mem_fn.hpp' in this directory or the documentation // of the CallTraits utility [1]. // // // References // ========== // // [1] http://www.boost.org/libs/utility/call_traits.htm #ifndef BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED #define BOOST_UTILITY_PARAM_TYPE_HPP_INCLUDED #include #include #include #include #include #include // #include // namespace boost namespace example { namespace mpl = boost::mpl; // namespace utility // { namespace param_type_detail { template struct by_ref_cond { typedef by_ref_cond type; BOOST_STATIC_CONSTANT(bool,value = sizeof(void*) < sizeof(T)); }; template struct add_ref_to_const : boost::add_reference< typename boost::add_const::type > { }; } template struct param_type : mpl::eval_if< param_type_detail::by_ref_cond , param_type_detail::add_ref_to_const, mpl::identity > { BOOST_MPL_AUX_LAMBDA_SUPPORT(1,param_type,(T)) }; // } // BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,utility::param_type) } #endif