name.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Copyright Daniel Wallin 2006.
  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_NAME_HPP
  6. #define BOOST_PARAMETER_AUX_NAME_HPP
  7. namespace boost { namespace parameter { namespace aux {
  8. struct name_tag_base
  9. {
  10. };
  11. template <typename Tag>
  12. struct name_tag
  13. {
  14. };
  15. }}} // namespace boost::parameter::aux
  16. #include <boost/mpl/bool.hpp>
  17. namespace boost { namespace parameter { namespace aux {
  18. template <typename T>
  19. struct is_name_tag : ::boost::mpl::false_
  20. {
  21. };
  22. }}} // namespace boost::parameter::aux
  23. #include <boost/parameter/value_type.hpp>
  24. #include <boost/mpl/placeholders.hpp>
  25. #include <boost/config.hpp>
  26. #include <boost/config/workaround.hpp>
  27. #if !defined(BOOST_NO_SFINAE) && \
  28. !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
  29. #include <boost/parameter/aux_/lambda_tag.hpp>
  30. #include <boost/mpl/lambda.hpp>
  31. #include <boost/mpl/bind.hpp>
  32. #include <boost/mpl/quote.hpp>
  33. #include <boost/core/enable_if.hpp>
  34. namespace boost { namespace mpl {
  35. template <typename T>
  36. struct lambda<
  37. T
  38. , typename ::boost::enable_if<
  39. ::boost::parameter::aux::is_name_tag<T>
  40. , ::boost::parameter::aux::lambda_tag
  41. >::type
  42. >
  43. {
  44. typedef ::boost::mpl::true_ is_le;
  45. typedef ::boost::mpl::bind3<
  46. ::boost::mpl::quote3< ::boost::parameter::value_type>
  47. , ::boost::mpl::arg<2>
  48. , T
  49. , void
  50. > result_;
  51. typedef result_ type;
  52. };
  53. }} // namespace boost::mpl
  54. #endif // SFINAE enabled, not Borland.
  55. #include <boost/parameter/aux_/void.hpp>
  56. #define BOOST_PARAMETER_TAG_PLACEHOLDER_TYPE(tag) \
  57. ::boost::parameter::value_type< \
  58. ::boost::mpl::_2,tag,::boost::parameter::void_ \
  59. >
  60. /**/
  61. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  62. #define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_VALUE(name, tag) \
  63. template <typename ArgumentPack> \
  64. using name = typename ::boost::parameter \
  65. ::value_type<ArgumentPack,tag,::boost::parameter::void_>::type
  66. /**/
  67. #include <boost/parameter/binding.hpp>
  68. #define BOOST_PARAMETER_TAG_MP11_PLACEHOLDER_BINDING(name, tag) \
  69. template <typename ArgumentPack> \
  70. using name = typename ::boost::parameter \
  71. ::binding<ArgumentPack,tag,::boost::parameter::void_>::type
  72. /**/
  73. #endif // BOOST_PARAMETER_CAN_USE_MP11
  74. #endif // include guard