1 // Copyright David Abrahams 2005. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #ifndef BOOST_PARAMETER_BINDING_DWA200558_HPP
5 # define BOOST_PARAMETER_BINDING_DWA200558_HPP
7 # include <boost/mpl/apply.hpp>
8 # include <boost/mpl/assert.hpp>
9 # include <boost/mpl/and.hpp>
10 # include <boost/parameter/aux_/result_of0.hpp>
11 # include <boost/parameter/aux_/void.hpp>
12 # include <boost/type_traits/is_same.hpp>
14 namespace boost { namespace parameter {
16 // A metafunction that, given an argument pack, returns the type of
17 // the parameter identified by the given keyword. If no such
18 // parameter has been specified, returns Default
20 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
21 template <class Parameters, class Keyword, class Default>
24 typedef typename mpl::apply_wrap3<
25 typename Parameters::binding,Keyword,Default,mpl::true_
28 BOOST_MPL_ASSERT_NOT((
30 is_same<Default, void_>
31 , is_same<type, void_>
37 template <class Parameters, class Keyword, class Default = void_>
40 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
41 typedef typename mpl::eval_if<
42 mpl::is_placeholder<Parameters>
44 , binding0<Parameters,Keyword,Default>
47 typedef typename mpl::apply_wrap3<
48 typename Parameters::binding,Keyword,Default,mpl::true_
51 BOOST_MPL_ASSERT_NOT((
53 is_same<Default, void_>
54 , is_same<type, void_>
59 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,binding,(Parameters,Keyword,Default))
62 // A metafunction that, given an argument pack, returns the type of
63 // the parameter identified by the given keyword. If no such
64 // parameter has been specified, returns the type returned by invoking
66 template <class Parameters, class Keyword, class DefaultFn>
69 typedef typename mpl::apply_wrap3<
70 typename Parameters::binding
72 , typename aux::result_of0<DefaultFn>::type
78 }} // namespace boost::parameter
80 #endif // BOOST_PARAMETER_BINDING_DWA200558_HPP