enum.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef BOOST_MPL_AUX_PREPROCESSOR_ENUM_HPP_INCLUDED
  2. #define BOOST_MPL_AUX_PREPROCESSOR_ENUM_HPP_INCLUDED
  3. // Copyright Aleksey Gurtovoy 2000-2004
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/mpl for documentation.
  10. // $Id$
  11. // $Date$
  12. // $Revision$
  13. #include <boost/mpl/aux_/config/preprocessor.hpp>
  14. // BOOST_MPL_PP_ENUM(0,int): <nothing>
  15. // BOOST_MPL_PP_ENUM(1,int): int
  16. // BOOST_MPL_PP_ENUM(2,int): int, int
  17. // BOOST_MPL_PP_ENUM(n,int): int, int, .., int
  18. #if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES)
  19. # include <boost/preprocessor/cat.hpp>
  20. # define BOOST_MPL_PP_ENUM(n, param) \
  21. BOOST_PP_CAT(BOOST_MPL_PP_ENUM_,n)(param) \
  22. /**/
  23. # define BOOST_MPL_PP_ENUM_0(p)
  24. # define BOOST_MPL_PP_ENUM_1(p) p
  25. # define BOOST_MPL_PP_ENUM_2(p) p,p
  26. # define BOOST_MPL_PP_ENUM_3(p) p,p,p
  27. # define BOOST_MPL_PP_ENUM_4(p) p,p,p,p
  28. # define BOOST_MPL_PP_ENUM_5(p) p,p,p,p,p
  29. # define BOOST_MPL_PP_ENUM_6(p) p,p,p,p,p,p
  30. # define BOOST_MPL_PP_ENUM_7(p) p,p,p,p,p,p,p
  31. # define BOOST_MPL_PP_ENUM_8(p) p,p,p,p,p,p,p,p
  32. # define BOOST_MPL_PP_ENUM_9(p) p,p,p,p,p,p,p,p,p
  33. #else
  34. # include <boost/preprocessor/comma_if.hpp>
  35. # include <boost/preprocessor/repeat.hpp>
  36. # define BOOST_MPL_PP_AUX_ENUM_FUNC(unused, i, param) \
  37. BOOST_PP_COMMA_IF(i) param \
  38. /**/
  39. # define BOOST_MPL_PP_ENUM(n, param) \
  40. BOOST_PP_REPEAT( \
  41. n \
  42. , BOOST_MPL_PP_AUX_ENUM_FUNC \
  43. , param \
  44. ) \
  45. /**/
  46. #endif
  47. #endif // BOOST_MPL_AUX_PREPROCESSOR_ENUM_HPP_INCLUDED