tag_deduced.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright David Abrahams, Daniel Wallin 2003.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
  6. #define BOOST_PARAMETER_AUX_PACK_TAG_DEDUCED_HPP
  7. #include <boost/parameter/aux_/set.hpp>
  8. #include <boost/parameter/aux_/pack/tag_type.hpp>
  9. #include <boost/parameter/config.hpp>
  10. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  11. #include <boost/mp11/list.hpp>
  12. #include <boost/mp11/utility.hpp>
  13. #else
  14. #include <boost/mpl/pair.hpp>
  15. #include <boost/mpl/apply_wrap.hpp>
  16. #endif
  17. namespace boost { namespace parameter { namespace aux {
  18. // Tags a deduced argument Arg with the keyword tag of Spec using TagFn.
  19. // Returns the tagged argument and the mpl::set<> UsedArgs with the
  20. // tag of Spec inserted.
  21. template <typename UsedArgs, typename Spec, typename Arg, typename TagFn>
  22. struct tag_deduced
  23. {
  24. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  25. using type = ::boost::mp11::mp_list<
  26. ::boost::mp11::mp_apply_q<
  27. TagFn
  28. , ::boost::mp11::mp_list<
  29. typename ::boost::parameter::aux::tag_type<Spec>::type
  30. , Arg
  31. >
  32. >
  33. #else
  34. typedef ::boost::mpl::pair<
  35. typename ::boost::mpl::apply_wrap2<
  36. TagFn
  37. , typename ::boost::parameter::aux::tag_type<Spec>::type
  38. , Arg
  39. >::type
  40. #endif // BOOST_PARAMETER_CAN_USE_MP11
  41. , typename ::boost::parameter::aux::insert_<
  42. UsedArgs
  43. , typename ::boost::parameter::aux::tag_type<Spec>::type
  44. >::type
  45. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  46. >;
  47. #else
  48. > type;
  49. #endif
  50. };
  51. }}} // namespace boost::parameter::aux
  52. #endif // include guard