Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/parameter/aux_/default.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright Daniel Wallin, David Abrahams 2005.
0002 // Copyright Cromwell D. Enage 2017.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_PARAMETER_AUX_DEFAULT_HPP
0008 #define BOOST_PARAMETER_AUX_DEFAULT_HPP
0009 
0010 namespace boost { namespace parameter { namespace aux {
0011 
0012     // A wrapper for the default value passed by the user when resolving
0013     // the value of the parameter with the given Keyword
0014     template <typename Keyword, typename Value>
0015     struct default_
0016     {
0017         inline BOOST_CONSTEXPR default_(Value& x) : value(x)
0018         {
0019         }
0020 
0021         Value& value;
0022     };
0023 }}} // namespace boost::parameter::aux
0024 
0025 #include <boost/parameter/config.hpp>
0026 
0027 namespace boost { namespace parameter { namespace aux {
0028 
0029     // lazy_default -- A wrapper for the default value computation function
0030     // passed by the user when resolving the value of the parameter with the
0031     // given keyword.
0032 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
0033     // These compilers need a little extra help with overload resolution;
0034     // we have empty_arg_list's operator[] accept a base class
0035     // to make that overload less preferable.
0036     template <typename KW, typename DefaultComputer>
0037     struct lazy_default_base
0038     {
0039         inline BOOST_CONSTEXPR lazy_default_base(DefaultComputer& x)
0040           : compute_default(x)
0041         {
0042         }
0043 
0044         DefaultComputer& compute_default;
0045     };
0046 
0047     template <typename KW, typename DefaultComputer>
0048     struct lazy_default
0049       : ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>
0050     {
0051         inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
0052           : ::boost::parameter::aux::lazy_default_base<KW,DefaultComputer>(x)
0053         {
0054         }
0055     };
0056 #else   // !BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
0057     template <typename KW, typename DefaultComputer>
0058     struct lazy_default
0059     {
0060         inline BOOST_CONSTEXPR lazy_default(DefaultComputer& x)
0061           : compute_default(x)
0062         {
0063         }
0064 
0065         DefaultComputer& compute_default;
0066     };
0067 #endif  // EDG workarounds needed.
0068 }}} // namespace boost::parameter::aux
0069 
0070 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
0071 #define BOOST_PARAMETER_lazy_default_fallback \
0072     ::boost::parameter::aux::lazy_default_base
0073 /**/
0074 #else
0075 #define BOOST_PARAMETER_lazy_default_fallback \
0076     ::boost::parameter::aux::lazy_default
0077 /**/
0078 #endif
0079 
0080 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0081 
0082 #include <utility>
0083 
0084 namespace boost { namespace parameter { namespace aux {
0085 
0086     template <typename Keyword, typename Value>
0087     struct default_r_
0088     {
0089         inline BOOST_CONSTEXPR default_r_(Value&& x)
0090           : value(::std::forward<Value>(x))
0091         {
0092         }
0093 
0094 #if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
0095         // MSVC 2015 miscompiles moves for classes containing rvalue ref members
0096         // using the default generated move constructor
0097         // when moving into a function
0098         // https://github.com/boostorg/parameter/pull/109
0099         inline BOOST_CONSTEXPR default_r_(default_r_&& x)
0100           : value(::std::forward<Value>(x.value))
0101         {
0102         }
0103 #endif
0104 
0105         Value&& value;
0106     };
0107 }}} // namespace boost::parameter::aux
0108 
0109 #endif  // BOOST_PARAMETER_HAS_PERFECT_FORWARDING
0110 #endif  // include guard
0111