1 // Copyright Daniel Wallin, David Abrahams 2005.
2 // Copyright Cromwell D. Enage 2017.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef DEFAULT_050329_HPP
8 #define DEFAULT_050329_HPP
10 namespace boost { namespace parameter { namespace aux {
12 // A wrapper for the default value passed by the user when resolving
13 // the value of the parameter with the given Keyword
14 template <typename Keyword, typename Value>
17 inline BOOST_CONSTEXPR default_(Value& x) : value(x)
23 }}} // namespace boost::parameter::aux
25 #include <boost/parameter/config.hpp>
27 namespace boost { namespace parameter { namespace aux {
29 // lazy_default -- A wrapper for the default value computation function
30 // passed by the user when resolving the value of the parameter with the
32 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
33 // These compilers need a little extra help with overload resolution;
34 // we have empty_arg_list's operator[] accept a base class
35 // to make that overload less preferable.
36 template <typename KW, typename DefaultComputer>
37 struct lazy_default_base
39 inline BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x)
44 DefaultComputer& compute_default;
47 template <typename KW, typename DefaultComputer>
49 : ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>
51 inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
52 : ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>(x)
56 #else // !BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
57 template <typename KW, typename DefaultComputer>
60 inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
65 DefaultComputer& compute_default;
67 #endif // EDG workarounds needed.
68 }}} // namespace boost::parameter::aux
70 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
71 #define BOOST_PARAMETER_lazy_default_fallback \
72 ::boost::parameter::aux::lazy_default_base
75 #define BOOST_PARAMETER_lazy_default_fallback \
76 ::boost::parameter::aux::lazy_default
80 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
84 namespace boost { namespace parameter { namespace aux {
86 template <typename Keyword, typename Value>
89 inline BOOST_CONSTEXPR default_r_(Value&& x)
90 : value(::std::forward<Value>(x))
96 }}} // namespace boost::parameter::aux
98 #endif // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
99 #endif // include guard