pop_back.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_BACK_HPP
  13. # define BOOST_PREPROCESSOR_TUPLE_POP_BACK_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/array/pop_back.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. # /* BOOST_PP_TUPLE_POP_BACK */
  24. #
  25. # define BOOST_PP_TUPLE_POP_BACK(tuple) \
  26. BOOST_PP_IIF \
  27. ( \
  28. BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \
  29. BOOST_PP_TUPLE_POP_BACK_EXEC, \
  30. BOOST_PP_TUPLE_POP_BACK_RETURN \
  31. ) \
  32. (tuple) \
  33. /**/
  34. #
  35. # define BOOST_PP_TUPLE_POP_BACK_EXEC(tuple) \
  36. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(BOOST_PP_TUPLE_TO_ARRAY(tuple))) \
  37. /**/
  38. #
  39. # define BOOST_PP_TUPLE_POP_BACK_RETURN(tuple) tuple
  40. #
  41. # /* BOOST_PP_TUPLE_POP_BACK_Z */
  42. #
  43. # define BOOST_PP_TUPLE_POP_BACK_Z(z, tuple) \
  44. BOOST_PP_IIF \
  45. ( \
  46. BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \
  47. BOOST_PP_TUPLE_POP_BACK_Z_EXEC, \
  48. BOOST_PP_TUPLE_POP_BACK_Z_RETURN \
  49. ) \
  50. (z, tuple) \
  51. /**/
  52. #
  53. # define BOOST_PP_TUPLE_POP_BACK_Z_EXEC(z, tuple) \
  54. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK_Z(z, BOOST_PP_TUPLE_TO_ARRAY(tuple))) \
  55. /**/
  56. #
  57. # define BOOST_PP_TUPLE_POP_BACK_Z_RETURN(z, tuple) tuple
  58. #
  59. # endif // BOOST_PREPROCESSOR_TUPLE_POP_BACK_HPP