// Copyright Daniel Wallin, David Abrahams 2005. // Copyright Cromwell D. Enage 2017. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef ACTIV_BOOST_PARAMETER_AUX_DEFAULT_HPP #define ACTIV_BOOST_PARAMETER_AUX_DEFAULT_HPP namespace Boost { namespace parameter { namespace aux { // A wrapper for the default value passed by the user when resolving // the value of the parameter with the given Keyword template struct default_ { inline ACTIV_BOOST_CONSTEXPR default_(Value& x) : value(x) { } Value& value; }; }}} // namespace Boost::parameter::aux #include namespace Boost { namespace parameter { namespace aux { // lazy_default -- A wrapper for the default value computation function // passed by the user when resolving the value of the parameter with the // given keyword. #if ACTIV_BOOST_WORKAROUND(__EDG_VERSION__, <= 300) // These compilers need a little extra help with overload resolution; // we have empty_arg_list's operator[] accept a base class // to make that overload less preferable. template struct lazy_default_base { inline ACTIV_BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x) : compute_default(x) { } DefaultComputer& compute_default; }; template struct lazy_default : ::Boost::parameter::aux::lazy_default_base { inline ACTIV_BOOST_CONSTEXPR lazy_default(DefaultComputer& x) : ::Boost::parameter::aux::lazy_default_base(x) { } }; #else // !ACTIV_BOOST_WORKAROUND(__EDG_VERSION__, <= 300) template struct lazy_default { inline ACTIV_BOOST_CONSTEXPR lazy_default(DefaultComputer& x) : compute_default(x) { } DefaultComputer& compute_default; }; #endif // EDG workarounds needed. }}} // namespace Boost::parameter::aux #if ACTIV_BOOST_WORKAROUND(__EDG_VERSION__, <= 300) #define ACTIV_BOOST_PARAMETER_lazy_default_fallback \ ::Boost::parameter::aux::lazy_default_base /**/ #else #define ACTIV_BOOST_PARAMETER_lazy_default_fallback \ ::Boost::parameter::aux::lazy_default /**/ #endif #if defined(ACTIV_BOOST_PARAMETER_HAS_PERFECT_FORWARDING) #include namespace Boost { namespace parameter { namespace aux { template struct default_r_ { inline ACTIV_BOOST_CONSTEXPR default_r_(Value&& x) : value(::std::forward(x)) { } #if ACTIV_BOOST_WORKAROUND(ACTIV_BOOST_MSVC, < 1910) // MSVC 2015 miscompiles moves for classes containing rvalue ref members // using the default generated move constructor // when moving into a function // https://github.com/boostorg/parameter/pull/109 inline ACTIV_BOOST_CONSTEXPR default_r_(default_r_&& x) : value(::std::forward(x.value)) { } #endif Value&& value; }; }}} // namespace Boost::parameter::aux #endif // ACTIV_BOOST_PARAMETER_HAS_PERFECT_FORWARDING #endif // include guard