// Copyright Daniel Wallin 2006. // 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 BOOST_PARAMETER_TEMPLATE_KEYWORD_HPP #define BOOST_PARAMETER_TEMPLATE_KEYWORD_HPP #include #include #if defined(BOOST_PARAMETER_CAN_USE_MP11) #include #include #include #else #include #include #include #include #include #include #include #endif namespace boost { namespace parameter { template struct template_keyword : ::boost::parameter::aux::template_keyword_base { typedef Tag key_type; typedef T value_type; // reference is needed for two reasons: // // 1. It is used in the body of arg_list<...> // // 2. It is the result of binding<...>, which we mistakenly told // people to use instead of value_type<...> to access named // template parameters // // It used to be that reference == value_type, but that broke when // the argument was a function or array type, because various // arg_list functions return reference. // // Simply making reference == value_type& would break all the // legacy code that uses binding<...> to access named template // parameters. -- David Abrahams #if defined(BOOST_PARAMETER_CAN_USE_MP11) using reference = typename ::boost::mp11::mp_eval_if< ::boost::mp11::mp_if< ::std::is_function , ::boost::mp11::mp_true , ::std::is_array > , ::std::add_lvalue_reference , ::boost::mp11::mp_identity , value_type >::type; #else typedef typename ::boost::mpl::eval_if< typename ::boost::mpl::if_< ::boost::is_function , ::boost::mpl::true_ , ::boost::is_array >::type , ::boost::add_lvalue_reference , ::boost::mpl::identity >::type reference; #endif // BOOST_PARAMETER_CAN_USE_MP11 }; }} // namespace boost::parameter #define BOOST_PARAMETER_TEMPLATE_KEYWORD(name) \ namespace tag \ { \ struct name; \ } \ template \ struct name : ::boost::parameter::template_keyword \ { \ }; /**/ #endif // include guard