push_back.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2002.
  4. # * (C) Copyright Edward Diener 2014.
  5. # * Distributed under the Boost Software License, Version 1.0. (See
  6. # * accompanying file LICENSE_1_0.txt or copy at
  7. # * http://www.boost.org/LICENSE_1_0.txt)
  8. # * *
  9. # ************************************************************************** */
  10. #
  11. # /* See http://www.boost.org for most recent version. */
  12. #
  13. # ifndef BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP
  14. # define BOOST_PREPROCESSOR_ARRAY_PUSH_BACK_HPP
  15. #
  16. # include <boost/preprocessor/arithmetic/inc.hpp>
  17. # include <boost/preprocessor/array/data.hpp>
  18. # include <boost/preprocessor/array/size.hpp>
  19. # include <boost/preprocessor/config/config.hpp>
  20. # include <boost/preprocessor/punctuation/comma_if.hpp>
  21. # include <boost/preprocessor/tuple/rem.hpp>
  22. # include <boost/preprocessor/array/detail/get_data.hpp>
  23. #
  24. # /* BOOST_PP_ARRAY_PUSH_BACK */
  25. #
  26. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
  27. # define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
  28. # else
  29. # define BOOST_PP_ARRAY_PUSH_BACK(array, elem) BOOST_PP_ARRAY_PUSH_BACK_D(array, elem)
  30. # define BOOST_PP_ARRAY_PUSH_BACK_D(array, elem) BOOST_PP_ARRAY_PUSH_BACK_I(BOOST_PP_ARRAY_SIZE(array), BOOST_PP_ARRAY_DATA(array), elem)
  31. # endif
  32. #
  33. # define BOOST_PP_ARRAY_PUSH_BACK_I(size, data, elem) (BOOST_PP_INC(size), (BOOST_PP_ARRAY_DETAIL_GET_DATA(size,data) BOOST_PP_COMMA_IF(size) elem))
  34. #
  35. # endif