pop_back.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // (C) Copyright Edward Diener 2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_SEQ_POP_BACK_HPP)
  6. #define BOOST_VMD_SEQ_POP_BACK_HPP
  7. #include <boost/vmd/detail/setup.hpp>
  8. #if BOOST_PP_VARIADICS
  9. #include <boost/preprocessor/comparison/equal.hpp>
  10. #include <boost/preprocessor/control/iif.hpp>
  11. #include <boost/preprocessor/seq/pop_back.hpp>
  12. #include <boost/preprocessor/seq/size.hpp>
  13. #include <boost/vmd/empty.hpp>
  14. /*
  15. The succeeding comments in this file are in doxygen format.
  16. */
  17. /** \file
  18. */
  19. /** \def BOOST_VMD_SEQ_POP_BACK(seq)
  20. \brief pops an element from the end of a seq.
  21. seq = seq to pop an element from.
  22. If the seq is an empty seq the result is undefined.
  23. If the seq is a single element the result is an empty seq.
  24. Otherwise the result is a seq after removing the last element.
  25. */
  26. #define BOOST_VMD_SEQ_POP_BACK(seq) \
  27. BOOST_PP_IIF \
  28. ( \
  29. BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(seq),1), \
  30. BOOST_VMD_EMPTY, \
  31. BOOST_PP_SEQ_POP_BACK \
  32. ) \
  33. (seq) \
  34. /**/
  35. #endif /* BOOST_PP_VARIADICS */
  36. #endif /* BOOST_VMD_SEQ_POP_BACK_HPP */