rest_n.hpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2002.
  4. # * Distributed under the Boost Software License, Version 1.0. (See
  5. # * accompanying file LICENSE_1_0.txt or copy at
  6. # * http://www.boost.org/LICENSE_1_0.txt)
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # ifndef BOOST_PREPROCESSOR_SEQ_REST_N_HPP
  13. # define BOOST_PREPROCESSOR_SEQ_REST_N_HPP
  14. #
  15. # include <boost/preprocessor/arithmetic/inc.hpp>
  16. # include <boost/preprocessor/comparison/not_equal.hpp>
  17. # include <boost/preprocessor/config/config.hpp>
  18. # include <boost/preprocessor/control/expr_iif.hpp>
  19. # include <boost/preprocessor/facilities/identity.hpp>
  20. # include <boost/preprocessor/logical/bitand.hpp>
  21. # include <boost/preprocessor/seq/detail/is_empty.hpp>
  22. # include <boost/preprocessor/seq/detail/split.hpp>
  23. # include <boost/preprocessor/tuple/elem.hpp>
  24. #
  25. # /* BOOST_PP_SEQ_REST_N */
  26. #
  27. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  28. # define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq))
  29. # else
  30. # define BOOST_PP_SEQ_REST_N(n, seq) BOOST_PP_SEQ_REST_N_I(n, seq)
  31. # define BOOST_PP_SEQ_REST_N_I(n, seq) BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq))
  32. # endif
  33. #
  34. # define BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, size) \
  35. BOOST_PP_EXPR_IIF \
  36. ( \
  37. BOOST_PP_BITAND \
  38. ( \
  39. BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size), \
  40. BOOST_PP_NOT_EQUAL(n,size) \
  41. ), \
  42. BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() \
  43. ) \
  44. /**/
  45. #
  46. # endif