[857] | 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
|
---|
| 6 |
|
---|
| 7 | # include <boost/mpl/apply.hpp>
|
---|
| 8 | # include <boost/parameter/aux_/result_of0.hpp>
|
---|
| 9 |
|
---|
| 10 | # include <boost/parameter/aux_/void.hpp>
|
---|
| 11 |
|
---|
| 12 | # if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
---|
| 13 | # include <boost/parameter/aux_/void.hpp>
|
---|
| 14 | # include <boost/type_traits/is_same.hpp>
|
---|
| 15 | # endif
|
---|
| 16 |
|
---|
| 17 | namespace boost { namespace parameter {
|
---|
| 18 |
|
---|
| 19 | // A metafunction that, given an argument pack, returns the type of
|
---|
| 20 | // the parameter identified by the given keyword. If no such
|
---|
| 21 | // parameter has been specified, returns Default
|
---|
| 22 | # if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
---|
| 23 | template <class Parameters, class Keyword, class Default = void>
|
---|
| 24 | struct binding
|
---|
| 25 | : mpl::apply_wrap2<
|
---|
| 26 | typename Parameters::binding,Keyword,Default
|
---|
| 27 | >
|
---|
| 28 | {};
|
---|
| 29 | # else
|
---|
| 30 | template <class Parameters, class Keyword, class Default = aux::void_>
|
---|
| 31 | struct binding
|
---|
| 32 | {
|
---|
| 33 | typedef typename mpl::apply_wrap2<
|
---|
| 34 | typename Parameters::binding,Keyword,
|
---|
| 35 | typename mpl::if_<is_same<Default,aux::void_>,void,Default>::type
|
---|
| 36 | >::type type;
|
---|
| 37 | };
|
---|
| 38 | # endif
|
---|
| 39 |
|
---|
| 40 | // A metafunction that, given an argument pack, returns the type of
|
---|
| 41 | // the parameter identified by the given keyword. If no such
|
---|
| 42 | // parameter has been specified, returns the type returned by invoking
|
---|
| 43 | // DefaultFn
|
---|
| 44 | template <class Parameters, class Keyword, class DefaultFn>
|
---|
| 45 | struct lazy_binding
|
---|
| 46 | {
|
---|
| 47 | typedef typename mpl::apply_wrap2<
|
---|
| 48 | typename Parameters::binding
|
---|
| 49 | , Keyword
|
---|
| 50 | , typename aux::result_of0<DefaultFn>::type
|
---|
| 51 | >::type type;
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | }} // namespace boost::parameter
|
---|
| 56 |
|
---|
| 57 | #endif // BOOST_PARAMETER_BINDING_DWA200558_HPP
|
---|