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