get_type.hpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_GET_TYPE_HPP)
  6. #define BOOST_VMD_GET_TYPE_HPP
  7. #include <boost/vmd/detail/setup.hpp>
  8. #if BOOST_PP_VARIADICS
  9. #include <boost/vmd/detail/sequence_type.hpp>
  10. /*
  11. The succeeding comments in this file are in doxygen format.
  12. */
  13. /** \file
  14. */
  15. /** \def BOOST_VMD_GET_TYPE(...)
  16. \brief Returns the type of a sequence as a VMD type.
  17. ... = variadic parameters.
  18. The first variadic parameter is required and is the sequence whose type we are getting.
  19. The optional variadic parameters are return type parameters.
  20. The macro returns the type of a sequence as a VMD type. The type of an empty sequence
  21. is always BOOST_VMD_TYPE_EMPTY and the type of a multi-element is always
  22. BOOST_VMD_TYPE_SEQUENCE. The type of a single-element sequence is the
  23. type of that single element.
  24. The type returned can be modified by specifying an optional return type parameter.
  25. If BOOST_VMD_RETURN_TYPE, the default, is specified the specific type of the element
  26. is returned.
  27. If BOOST_VMD_RETURN_TYPE_ARRAY is specified
  28. an array type is returned if the element is an array, else a tuple
  29. type is returned if the element is a tuple, else the actual type
  30. is returned for non-tuple data.
  31. If BOOST_VMD_RETURN_TYPE_LIST is specified
  32. a list type is returned if the element is a list, else a tuple
  33. type is returned if the element is a tuple, else the actual type
  34. is returned for non-tuple data.
  35. If BOOST_VMD_RETURN_TYPE_TUPLE is specified
  36. a tuple type is returned for all tuple-like data, else the actual type
  37. is returned for non-tuple data.
  38. If BOOST_VMD_RETURN_NO_TYPE is specified it is ignored since the macro
  39. always returns the type of the sequence.
  40. If more than one return type optional parameter is specified the last
  41. one specified determines the return type.
  42. returns = the type of the sequence as a VMD type.
  43. */
  44. #define BOOST_VMD_GET_TYPE(...) \
  45. BOOST_VMD_DETAIL_SEQUENCE_TYPE(__VA_ARGS__) \
  46. /**/
  47. /** \def BOOST_VMD_GET_TYPE_D(d,...)
  48. \brief Returns the type of a sequence as a VMD type. Re-entrant version.
  49. d = The next available BOOST_PP_WHILE iteration.
  50. ... = variadic parameters.
  51. The first variadic parameter is required and is the sequence whose type we are getting.
  52. The optional variadic parameters are return type parameters.
  53. The macro returns the type of a sequence as a VMD type. The type of an empty sequence
  54. is always BOOST_VMD_TYPE_EMPTY and the type of a multi-element is always
  55. BOOST_VMD_TYPE_SEQUENCE. The type of a single-element sequence is the
  56. type of that single element.
  57. The type returned can be modified by specifying an optional return type parameter.
  58. If BOOST_VMD_RETURN_TYPE, the default, is specified the specific type of the element
  59. is returned.
  60. If BOOST_VMD_RETURN_TYPE_ARRAY is specified
  61. an array type is returned if the element is an array, else a tuple
  62. type is returned if the element is a tuple, else the actual type
  63. is returned for non-tuple data.
  64. If BOOST_VMD_RETURN_TYPE_LIST is specified
  65. a list type is returned if the element is a list, else a tuple
  66. type is returned if the element is a tuple, else the actual type
  67. is returned for non-tuple data.
  68. If BOOST_VMD_RETURN_TYPE_TUPLE is specified
  69. a tuple type is returned for all tuple-like data, else the actual type
  70. is returned for non-tuple data.
  71. If BOOST_VMD_RETURN_NO_TYPE is specified it is ignored since the macro
  72. always returns the type of the sequence.
  73. If more than one return type optional parameter is specified the last
  74. one specified determines the return type.
  75. returns = the type of the sequence as a VMD type.
  76. */
  77. #define BOOST_VMD_GET_TYPE_D(d,...) \
  78. BOOST_VMD_DETAIL_SEQUENCE_TYPE_D(d,__VA_ARGS__) \
  79. /**/
  80. #endif /* BOOST_PP_VARIADICS */
  81. #endif /* BOOST_VMD_GET_TYPE_HPP */