Chris@16
|
1 // Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
|
Chris@16
|
2 // distribution is subject to the Boost Software License, Version 1.0. (See
|
Chris@16
|
3 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5
|
Chris@16
|
6 #ifndef DEFAULT_050329_HPP
|
Chris@16
|
7 # define DEFAULT_050329_HPP
|
Chris@16
|
8
|
Chris@16
|
9 # include <boost/detail/workaround.hpp>
|
Chris@16
|
10
|
Chris@16
|
11 namespace boost { namespace parameter { namespace aux {
|
Chris@16
|
12
|
Chris@16
|
13 // A wrapper for the default value passed by the user when resolving
|
Chris@16
|
14 // the value of the parameter with the given Keyword
|
Chris@16
|
15 template <class Keyword, class Value>
|
Chris@16
|
16 struct default_
|
Chris@16
|
17 {
|
Chris@16
|
18 default_(Value& x)
|
Chris@16
|
19 : value(x)
|
Chris@16
|
20 {}
|
Chris@16
|
21
|
Chris@16
|
22 Value& value;
|
Chris@16
|
23 };
|
Chris@16
|
24
|
Chris@16
|
25 //
|
Chris@16
|
26 // lazy_default --
|
Chris@16
|
27 //
|
Chris@16
|
28 // A wrapper for the default value computation function passed by
|
Chris@16
|
29 // the user when resolving the value of the parameter with the
|
Chris@16
|
30 // given keyword
|
Chris@16
|
31 //
|
Chris@16
|
32 # if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
|
Chris@16
|
33 // These compilers need a little extra help with overload
|
Chris@16
|
34 // resolution; we have empty_arg_list's operator[] accept a base
|
Chris@16
|
35 // class to make that overload less preferable.
|
Chris@16
|
36 template <class KW, class DefaultComputer>
|
Chris@16
|
37 struct lazy_default_base
|
Chris@16
|
38 {
|
Chris@16
|
39 lazy_default_base(DefaultComputer const& x)
|
Chris@16
|
40 : compute_default(x)
|
Chris@16
|
41 {}
|
Chris@16
|
42 DefaultComputer const& compute_default;
|
Chris@16
|
43 };
|
Chris@16
|
44
|
Chris@16
|
45 template <class KW, class DefaultComputer>
|
Chris@16
|
46 struct lazy_default
|
Chris@16
|
47 : lazy_default_base<KW,DefaultComputer>
|
Chris@16
|
48 {
|
Chris@16
|
49 lazy_default(DefaultComputer const & x)
|
Chris@16
|
50 : lazy_default_base<KW,DefaultComputer>(x)
|
Chris@16
|
51 {}
|
Chris@16
|
52 };
|
Chris@16
|
53 # define BOOST_PARAMETER_lazy_default_fallback lazy_default_base
|
Chris@16
|
54 # else
|
Chris@16
|
55 template <class KW, class DefaultComputer>
|
Chris@16
|
56 struct lazy_default
|
Chris@16
|
57 {
|
Chris@16
|
58 lazy_default(const DefaultComputer& x)
|
Chris@16
|
59 : compute_default(x)
|
Chris@16
|
60 {}
|
Chris@16
|
61 DefaultComputer const& compute_default;
|
Chris@16
|
62 };
|
Chris@16
|
63 # define BOOST_PARAMETER_lazy_default_fallback lazy_default
|
Chris@16
|
64 # endif
|
Chris@16
|
65
|
Chris@16
|
66 }}} // namespace boost::parameter::aux
|
Chris@16
|
67
|
Chris@16
|
68 #endif // DEFAULT_050329_HPP
|
Chris@16
|
69
|