enum.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2011. *
  4. # * (C) Copyright Paul Mensonides 2011. *
  5. # * Distributed under the Boost Software License, Version 1.0. (See *
  6. # * accompanying file LICENSE_1_0.txt or copy at *
  7. # * http://www.boost.org/LICENSE_1_0.txt) *
  8. # * *
  9. # ************************************************************************** */
  10. #
  11. # /* See http://www.boost.org for most recent version. */
  12. #
  13. # ifndef BOOST_PREPROCESSOR_ARRAY_ENUM_HPP
  14. # define BOOST_PREPROCESSOR_ARRAY_ENUM_HPP
  15. #
  16. # include <boost/preprocessor/cat.hpp>
  17. # include <boost/preprocessor/config/config.hpp>
  18. # include <boost/preprocessor/control/if.hpp>
  19. # include <boost/preprocessor/array/size.hpp>
  20. # include <boost/preprocessor/tuple/rem.hpp>
  21. # include <boost/preprocessor/variadic/has_opt.hpp>
  22. #
  23. # /* BOOST_PP_ARRAY_ENUM */
  24. #
  25. # if BOOST_PP_VARIADIC_HAS_OPT()
  26. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
  27. # define BOOST_PP_ARRAY_ENUM_NOT_EMPTY(array) BOOST_PP_ARRAY_ENUM_I(BOOST_PP_TUPLE_REM_CTOR, array)
  28. # define BOOST_PP_ARRAY_ENUM_I(m, args) BOOST_PP_ARRAY_ENUM_II(m, args)
  29. # define BOOST_PP_ARRAY_ENUM_II(m, args) BOOST_PP_CAT(m ## args,)
  30. # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  31. # define BOOST_PP_ARRAY_ENUM_NOT_EMPTY(array) BOOST_PP_ARRAY_ENUM_I(array)
  32. # define BOOST_PP_ARRAY_ENUM_I(array) BOOST_PP_TUPLE_REM_CTOR ## array
  33. # else
  34. # define BOOST_PP_ARRAY_ENUM_NOT_EMPTY(array) BOOST_PP_TUPLE_REM_CTOR array
  35. # endif
  36. # define BOOST_PP_ARRAY_ENUM_EMPTY(array)
  37. # define BOOST_PP_ARRAY_ENUM(array) BOOST_PP_IF(BOOST_PP_ARRAY_SIZE(array),BOOST_PP_ARRAY_ENUM_NOT_EMPTY,BOOST_PP_ARRAY_ENUM_EMPTY)(array)
  38. # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
  39. # define BOOST_PP_ARRAY_ENUM(array) BOOST_PP_ARRAY_ENUM_I(BOOST_PP_TUPLE_REM_CTOR, array)
  40. # define BOOST_PP_ARRAY_ENUM_I(m, args) BOOST_PP_ARRAY_ENUM_II(m, args)
  41. # define BOOST_PP_ARRAY_ENUM_II(m, args) BOOST_PP_CAT(m ## args,)
  42. # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  43. # define BOOST_PP_ARRAY_ENUM(array) BOOST_PP_ARRAY_ENUM_I(array)
  44. # define BOOST_PP_ARRAY_ENUM_I(array) BOOST_PP_TUPLE_REM_CTOR ## array
  45. # else
  46. # define BOOST_PP_ARRAY_ENUM(array) BOOST_PP_TUPLE_REM_CTOR array
  47. # endif
  48. #
  49. # endif