adt.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # /* Copyright (C) 2001
  2. # * Housemarque Oy
  3. # * http://www.housemarque.com
  4. # *
  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. # * See http://www.boost.org for most recent version.
  10. # */
  11. #
  12. # /* Revised by Paul Mensonides (2002) */
  13. #
  14. # ifndef BOOST_PREPROCESSOR_LIST_ADT_HPP
  15. # define BOOST_PREPROCESSOR_LIST_ADT_HPP
  16. #
  17. # include <boost/preprocessor/config/config.hpp>
  18. # include <boost/preprocessor/detail/is_binary.hpp>
  19. # include <boost/preprocessor/logical/compl.hpp>
  20. # include <boost/preprocessor/tuple/eat.hpp>
  21. #
  22. # /* BOOST_PP_LIST_CONS */
  23. #
  24. # define BOOST_PP_LIST_CONS(head, tail) (head, tail)
  25. #
  26. # /* BOOST_PP_LIST_NIL */
  27. #
  28. # define BOOST_PP_LIST_NIL BOOST_PP_NIL
  29. #
  30. # /* BOOST_PP_LIST_FIRST */
  31. #
  32. # define BOOST_PP_LIST_FIRST(list) BOOST_PP_LIST_FIRST_D(list)
  33. #
  34. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  35. # define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I list
  36. # else
  37. # define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I ## list
  38. # endif
  39. #
  40. # define BOOST_PP_LIST_FIRST_I(head, tail) head
  41. #
  42. # /* BOOST_PP_LIST_REST */
  43. #
  44. # define BOOST_PP_LIST_REST(list) BOOST_PP_LIST_REST_D(list)
  45. #
  46. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  47. # define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I list
  48. # else
  49. # define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I ## list
  50. # endif
  51. #
  52. # define BOOST_PP_LIST_REST_I(head, tail) tail
  53. #
  54. # /* BOOST_PP_LIST_IS_CONS */
  55. #
  56. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
  57. # define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_LIST_IS_CONS_D(list)
  58. # define BOOST_PP_LIST_IS_CONS_D(list) BOOST_PP_LIST_IS_CONS_ ## list
  59. # define BOOST_PP_LIST_IS_CONS_(head, tail) 1
  60. # define BOOST_PP_LIST_IS_CONS_BOOST_PP_NIL 0
  61. # else
  62. # define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_IS_BINARY(list)
  63. # endif
  64. #
  65. # /* BOOST_PP_LIST_IS_NIL */
  66. #
  67. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
  68. # define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_IS_BINARY(list))
  69. # else
  70. # define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_LIST_IS_CONS(list))
  71. # endif
  72. #
  73. # endif