pop_front.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2013.
  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_TUPLE_POP_FRONT_HPP
  13. # define BOOST_PREPROCESSOR_TUPLE_POP_FRONT_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/array/pop_front.hpp>
  17. # include <boost/preprocessor/array/to_tuple.hpp>
  18. # include <boost/preprocessor/comparison/greater.hpp>
  19. # include <boost/preprocessor/control/iif.hpp>
  20. # include <boost/preprocessor/tuple/size.hpp>
  21. # include <boost/preprocessor/tuple/to_array.hpp>
  22. #
  23. #
  24. # /* BOOST_PP_TUPLE_POP_FRONT */
  25. #
  26. # define BOOST_PP_TUPLE_POP_FRONT(tuple) \
  27. BOOST_PP_IIF \
  28. ( \
  29. BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \
  30. BOOST_PP_TUPLE_POP_FRONT_EXEC, \
  31. BOOST_PP_TUPLE_POP_FRONT_RETURN \
  32. ) \
  33. (tuple) \
  34. /**/
  35. #
  36. # define BOOST_PP_TUPLE_POP_FRONT_EXEC(tuple) \
  37. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_FRONT(BOOST_PP_TUPLE_TO_ARRAY(tuple))) \
  38. /**/
  39. #
  40. # define BOOST_PP_TUPLE_POP_FRONT_RETURN(tuple) tuple
  41. #
  42. # /* BOOST_PP_TUPLE_POP_FRONT_Z */
  43. #
  44. # define BOOST_PP_TUPLE_POP_FRONT_Z(z, tuple) \
  45. BOOST_PP_IIF \
  46. ( \
  47. BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \
  48. BOOST_PP_TUPLE_POP_FRONT_Z_EXEC, \
  49. BOOST_PP_TUPLE_POP_FRONT_Z_RETURN \
  50. ) \
  51. (z, tuple) \
  52. /**/
  53. #
  54. # define BOOST_PP_TUPLE_POP_FRONT_Z_EXEC(z, tuple) \
  55. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_FRONT_Z(z, BOOST_PP_TUPLE_TO_ARRAY(tuple))) \
  56. /**/
  57. #
  58. # define BOOST_PP_TUPLE_POP_FRONT_Z_RETURN(z, tuple) tuple
  59. #
  60. # endif // BOOST_PREPROCESSOR_TUPLE_POP_FRONT_HPP