| 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 | # |
| 10 | # /* Revised by Paul Mensonides (2002) */ |
| 11 | # |
| 12 | # /* See http://www.boost.org for most recent version. */ |
| 13 | # |
| 14 | # ifndef BOOST_PREPROCESSOR_LIST_REVERSE_HPP |
| 15 | # define BOOST_PREPROCESSOR_LIST_REVERSE_HPP |
| 16 | # |
| 17 | # include <boost/preprocessor/config/config.hpp> |
| 18 | # |
| 19 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() |
| 20 | # |
| 21 | # include <boost/preprocessor/list/fold_left.hpp> |
| 22 | # |
| 23 | # /* BOOST_PP_LIST_REVERSE */ |
| 24 | # |
| 25 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 26 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) |
| 27 | # else |
| 28 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_LIST_REVERSE_I(list) |
| 29 | # define BOOST_PP_LIST_REVERSE_I(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) |
| 30 | # endif |
| 31 | # |
| 32 | # define BOOST_PP_LIST_REVERSE_O(d, s, x) (x, s) |
| 33 | # |
| 34 | # /* BOOST_PP_LIST_REVERSE_D */ |
| 35 | # |
| 36 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 37 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) |
| 38 | # else |
| 39 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_LIST_REVERSE_D_I(d, list) |
| 40 | # define BOOST_PP_LIST_REVERSE_D_I(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_REVERSE_O, BOOST_PP_NIL, list) |
| 41 | # endif |
| 42 | # |
| 43 | # else |
| 44 | # |
| 45 | # include <boost/preprocessor/control/iif.hpp> |
| 46 | # include <boost/preprocessor/facilities/identity.hpp> |
| 47 | # include <boost/preprocessor/list/adt.hpp> |
| 48 | # include <boost/preprocessor/list/fold_left.hpp> |
| 49 | # |
| 50 | # /* BOOST_PP_LIST_REVERSE */ |
| 51 | # |
| 52 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 53 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS(list),BOOST_PP_LIST_REVERSE_CONS,BOOST_PP_IDENTITY_N(BOOST_PP_NIL,1))(list) |
| 54 | # else |
| 55 | # define BOOST_PP_LIST_REVERSE(list) BOOST_PP_LIST_REVERSE_I(list) |
| 56 | # define BOOST_PP_LIST_REVERSE_I(list) BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS(list),BOOST_PP_LIST_REVERSE_CONS,BOOST_PP_IDENTITY_N(BOOST_PP_NIL,1))(list) |
| 57 | # endif |
| 58 | # |
| 59 | # define BOOST_PP_LIST_REVERSE_O(d, s, x) (x, s) |
| 60 | # |
| 61 | # /* BOOST_PP_LIST_REVERSE_D */ |
| 62 | # |
| 63 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 64 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS(list),BOOST_PP_LIST_REVERSE_CONS_D,BOOST_PP_IDENTITY_N(BOOST_PP_NIL,2))(d,list) |
| 65 | # else |
| 66 | # define BOOST_PP_LIST_REVERSE_D(d, list) BOOST_PP_LIST_REVERSE_D_I(d, list) |
| 67 | # define BOOST_PP_LIST_REVERSE_D_I(d, list) BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS(list),BOOST_PP_LIST_REVERSE_CONS_D,BOOST_PP_IDENTITY_N(BOOST_PP_NIL,2))(d,list) |
| 68 | # endif |
| 69 | # |
| 70 | # define BOOST_PP_LIST_REVERSE_CONS(list) BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_REVERSE_O, (BOOST_PP_LIST_FIRST(list),BOOST_PP_NIL), BOOST_PP_LIST_REST(list)) |
| 71 | # define BOOST_PP_LIST_REVERSE_CONS_D(d, list) BOOST_PP_LIST_FOLD_LEFT_ ## d(BOOST_PP_LIST_REVERSE_O, (BOOST_PP_LIST_FIRST(list),BOOST_PP_NIL), BOOST_PP_LIST_REST(list)) |
| 72 | # |
| 73 | # endif |
| 74 | # |
| 75 | # endif |
| 76 | |