Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:31

0001 // Copyright Daniel Wallin 2006.
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_TEMPLATE_KEYWORD_HPP
0008 #define BOOST_PARAMETER_TEMPLATE_KEYWORD_HPP
0009 
0010 #include <boost/parameter/aux_/template_keyword.hpp>
0011 #include <boost/parameter/config.hpp>
0012 
0013 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0014 #include <boost/mp11/integral.hpp>
0015 #include <boost/mp11/utility.hpp>
0016 #include <type_traits>
0017 #else
0018 #include <boost/mpl/bool.hpp>
0019 #include <boost/mpl/if.hpp>
0020 #include <boost/mpl/eval_if.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/type_traits/add_lvalue_reference.hpp>
0023 #include <boost/type_traits/is_function.hpp>
0024 #include <boost/type_traits/is_array.hpp>
0025 #endif
0026 
0027 namespace boost { namespace parameter {
0028 
0029     template <typename Tag, typename T>
0030     struct template_keyword : ::boost::parameter::aux::template_keyword_base
0031     {
0032         typedef Tag key_type;
0033         typedef T value_type;
0034 
0035         // reference is needed for two reasons:
0036         //
0037         // 1. It is used in the body of arg_list<...>
0038         //
0039         // 2. It is the result of binding<...>, which we mistakenly told
0040         //    people to use instead of value_type<...> to access named
0041         //    template parameters
0042         //
0043         // It used to be that reference == value_type, but that broke when
0044         // the argument was a function or array type, because various
0045         // arg_list functions return reference.
0046         //
0047         // Simply making reference == value_type& would break all the
0048         // legacy code that uses binding<...> to access named template
0049         // parameters. -- David Abrahams
0050 #if defined(BOOST_PARAMETER_CAN_USE_MP11)
0051         using reference = typename ::boost::mp11::mp_eval_if<
0052             ::boost::mp11::mp_if<
0053                 ::std::is_function<value_type>
0054               , ::boost::mp11::mp_true
0055               , ::std::is_array<value_type>
0056             >
0057           , ::std::add_lvalue_reference<value_type>
0058           , ::boost::mp11::mp_identity
0059           , value_type
0060         >::type;
0061 #else
0062         typedef typename ::boost::mpl::eval_if<
0063             typename ::boost::mpl::if_<
0064                 ::boost::is_function<value_type>
0065               , ::boost::mpl::true_
0066               , ::boost::is_array<value_type>
0067             >::type
0068           , ::boost::add_lvalue_reference<value_type>
0069           , ::boost::mpl::identity<value_type>
0070         >::type reference;
0071 #endif  // BOOST_PARAMETER_CAN_USE_MP11
0072     };
0073 }} // namespace boost::parameter
0074 
0075 #define BOOST_PARAMETER_TEMPLATE_KEYWORD(name)                               \
0076     namespace tag                                                            \
0077     {                                                                        \
0078         struct name;                                                         \
0079     }                                                                        \
0080     template <typename T>                                                    \
0081     struct name : ::boost::parameter::template_keyword<tag::name,T>          \
0082     {                                                                        \
0083     };
0084 /**/
0085 
0086 #endif  // include guard
0087