1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef BOOST_PARAMETER_VALUE_TYPE_060921_HPP
6 # define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
8 # include <boost/mpl/apply.hpp>
9 # include <boost/mpl/assert.hpp>
10 # include <boost/mpl/and.hpp>
11 # include <boost/parameter/aux_/result_of0.hpp>
12 # include <boost/parameter/aux_/void.hpp>
13 # include <boost/type_traits/is_same.hpp>
15 namespace boost { namespace parameter {
17 // A metafunction that, given an argument pack, returns the type of
18 // the parameter identified by the given keyword. If no such
19 // parameter has been specified, returns Default
21 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
22 template <class Parameters, class Keyword, class Default>
25 typedef typename mpl::apply_wrap3<
26 typename Parameters::binding,Keyword,Default,mpl::false_
29 BOOST_MPL_ASSERT_NOT((
31 is_same<Default, void_>
32 , is_same<type, void_>
38 template <class Parameters, class Keyword, class Default = void_>
41 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
42 typedef typename mpl::eval_if<
43 mpl::is_placeholder<Parameters>
45 , value_type0<Parameters,Keyword,Default>
48 typedef typename mpl::apply_wrap3<
49 typename Parameters::binding,Keyword,Default,mpl::false_
52 BOOST_MPL_ASSERT_NOT((
54 is_same<Default, void_>
55 , is_same<type, void_>
60 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,value_type,(Parameters,Keyword,Default))
63 // A metafunction that, given an argument pack, returns the type of
64 // the parameter identified by the given keyword. If no such
65 // parameter has been specified, returns the type returned by invoking
67 template <class Parameters, class Keyword, class DefaultFn>
68 struct lazy_value_type
70 typedef typename mpl::apply_wrap3<
71 typename Parameters::binding
73 , typename aux::result_of0<DefaultFn>::type
79 }} // namespace boost::parameter
81 #endif // BOOST_PARAMETER_VALUE_TYPE_060921_HPP