to_list.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_TO_LIST_HPP)
  6. #define BOOST_VMD_SEQ_TO_LIST_HPP
  7. #include <boost/vmd/detail/setup.hpp>
  8. #if BOOST_PP_VARIADICS
  9. #include <boost/preprocessor/control/iif.hpp>
  10. #include <boost/preprocessor/seq/to_list.hpp>
  11. // #include <boost/vmd/identity.hpp>
  12. #include <boost/vmd/is_empty.hpp>
  13. /*
  14. The succeeding comments in this file are in doxygen format.
  15. */
  16. /** \file
  17. */
  18. /** \def BOOST_VMD_SEQ_TO_LIST(seq)
  19. \brief converts a seq to a list.
  20. seq = seq to be converted.
  21. If the seq is an empty seq it is converted to an empty list (BOOST_PP_NIL).
  22. Otherwise the seq is converted to a list with the same number of elements as the seq.
  23. */
  24. #if BOOST_VMD_MSVC
  25. #define BOOST_VMD_SEQ_TO_LIST(seq) \
  26. BOOST_PP_IIF \
  27. ( \
  28. BOOST_VMD_IS_EMPTY(seq), \
  29. BOOST_VMD_SEQ_TO_LIST_PE, \
  30. BOOST_VMD_SEQ_TO_LIST_NPE \
  31. ) \
  32. (seq) \
  33. /**/
  34. #define BOOST_VMD_SEQ_TO_LIST_PE(seq) BOOST_PP_NIL
  35. /**/
  36. #define BOOST_VMD_SEQ_TO_LIST_NPE(seq) BOOST_PP_SEQ_TO_LIST(seq)
  37. /**/
  38. #else
  39. #define BOOST_VMD_SEQ_TO_LIST(seq) \
  40. BOOST_PP_IIF \
  41. ( \
  42. BOOST_VMD_IS_EMPTY(seq), \
  43. BOOST_VMD_IDENTITY(BOOST_PP_NIL), \
  44. BOOST_PP_SEQ_TO_LIST \
  45. ) \
  46. (seq) \
  47. /**/
  48. #endif
  49. #endif /* BOOST_PP_VARIADICS */
  50. #endif /* BOOST_VMD_SEQ_TO_LIST_HPP */