remove.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_REMOVE_HPP
  13. # define BOOST_PREPROCESSOR_TUPLE_REMOVE_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/array/remove.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_REMOVE */
  24. #
  25. # define BOOST_PP_TUPLE_REMOVE(tuple, i) \
  26. BOOST_PP_IIF \
  27. ( \
  28. BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \
  29. BOOST_PP_TUPLE_REMOVE_EXEC, \
  30. BOOST_PP_TUPLE_REMOVE_RETURN \
  31. ) \
  32. (tuple, i) \
  33. /**/
  34. #
  35. # define BOOST_PP_TUPLE_REMOVE_EXEC(tuple, i) \
  36. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_REMOVE(BOOST_PP_TUPLE_TO_ARRAY(tuple), i)) \
  37. /**/
  38. #
  39. # define BOOST_PP_TUPLE_REMOVE_RETURN(tuple, i) tuple
  40. #
  41. # /* BOOST_PP_TUPLE_REMOVE_D */
  42. #
  43. # define BOOST_PP_TUPLE_REMOVE_D(d, tuple, i) \
  44. BOOST_PP_IIF \
  45. ( \
  46. BOOST_PP_GREATER_D(d, BOOST_PP_TUPLE_SIZE(tuple), 1), \
  47. BOOST_PP_TUPLE_REMOVE_D_EXEC, \
  48. BOOST_PP_TUPLE_REMOVE_D_RETURN \
  49. ) \
  50. (d, tuple, i) \
  51. /**/
  52. #
  53. # define BOOST_PP_TUPLE_REMOVE_D_EXEC(d, tuple, i) \
  54. BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_REMOVE_D(d, BOOST_PP_TUPLE_TO_ARRAY(tuple), i)) \
  55. /**/
  56. #
  57. # define BOOST_PP_TUPLE_REMOVE_D_RETURN(d, tuple, i) tuple
  58. #
  59. # endif // BOOST_PREPROCESSOR_TUPLE_REMOVE_HPP