Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/boost/parameter/binding.hpp @ 18

Last change on this file since 18 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 1.7 KB
Line 
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
17namespace 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)
23template <class Parameters, class Keyword, class Default = void>
24struct binding
25  : mpl::apply_wrap2<
26        typename Parameters::binding,Keyword,Default
27    >
28{};
29# else
30template <class Parameters, class Keyword, class Default = aux::void_>
31struct 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
44template <class Parameters, class Keyword, class DefaultFn>
45struct 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
Note: See TracBrowser for help on using the repository browser.