Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | # /* ************************************************************************** |
| 2 | # * * |
| 3 | # * (C) Copyright Paul Mensonides 2002. |
| 4 | # * Distributed under the Boost Software License, Version 1.0. (See |
| 5 | # * accompanying file LICENSE_1_0.txt or copy at |
| 6 | # * http://www.boost.org/LICENSE_1_0.txt) |
| 7 | # * * |
| 8 | # ************************************************************************** */ |
| 9 | # |
| 10 | # /* See http://www.boost.org for most recent version. */ |
| 11 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 12 | # ifndef NDNBOOST_PREPROCESSOR_SEQ_TRANSFORM_HPP |
| 13 | # define NDNBOOST_PREPROCESSOR_SEQ_TRANSFORM_HPP |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 14 | # |
| 15 | # include <ndnboost/preprocessor/config/config.hpp> |
| 16 | # include <ndnboost/preprocessor/seq/fold_left.hpp> |
| 17 | # include <ndnboost/preprocessor/seq/seq.hpp> |
| 18 | # include <ndnboost/preprocessor/tuple/elem.hpp> |
| 19 | # include <ndnboost/preprocessor/tuple/rem.hpp> |
| 20 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 21 | # /* NDNBOOST_PP_SEQ_TRANSFORM */ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 22 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 23 | # if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG() |
| 24 | # define NDNBOOST_PP_SEQ_TRANSFORM(op, data, seq) NDNBOOST_PP_SEQ_TAIL(NDNBOOST_PP_TUPLE_ELEM(3, 2, NDNBOOST_PP_SEQ_FOLD_LEFT(NDNBOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq))) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 25 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 26 | # define NDNBOOST_PP_SEQ_TRANSFORM(op, data, seq) NDNBOOST_PP_SEQ_TRANSFORM_I(op, data, seq) |
| 27 | # define NDNBOOST_PP_SEQ_TRANSFORM_I(op, data, seq) NDNBOOST_PP_SEQ_TAIL(NDNBOOST_PP_TUPLE_ELEM(3, 2, NDNBOOST_PP_SEQ_FOLD_LEFT(NDNBOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq))) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 28 | # endif |
| 29 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 30 | # if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT() |
| 31 | # define NDNBOOST_PP_SEQ_TRANSFORM_O(s, state, elem) NDNBOOST_PP_SEQ_TRANSFORM_O_IM(s, NDNBOOST_PP_TUPLE_REM_3 state, elem) |
| 32 | # define NDNBOOST_PP_SEQ_TRANSFORM_O_IM(s, im, elem) NDNBOOST_PP_SEQ_TRANSFORM_O_I(s, im, elem) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 33 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 34 | # define NDNBOOST_PP_SEQ_TRANSFORM_O(s, state, elem) NDNBOOST_PP_SEQ_TRANSFORM_O_I(s, NDNBOOST_PP_TUPLE_ELEM(3, 0, state), NDNBOOST_PP_TUPLE_ELEM(3, 1, state), NDNBOOST_PP_TUPLE_ELEM(3, 2, state), elem) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 35 | # endif |
| 36 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 37 | # define NDNBOOST_PP_SEQ_TRANSFORM_O_I(s, op, data, res, elem) (op, data, res (op(s, data, elem))) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 38 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 39 | # /* NDNBOOST_PP_SEQ_TRANSFORM_S */ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 40 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 41 | # if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG() |
| 42 | # define NDNBOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) NDNBOOST_PP_SEQ_TAIL(NDNBOOST_PP_TUPLE_ELEM(3, 2, NDNBOOST_PP_SEQ_FOLD_LEFT_ ## s(NDNBOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq))) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 43 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 44 | # define NDNBOOST_PP_SEQ_TRANSFORM_S(s, op, data, seq) NDNBOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq) |
| 45 | # define NDNBOOST_PP_SEQ_TRANSFORM_S_I(s, op, data, seq) NDNBOOST_PP_SEQ_TAIL(NDNBOOST_PP_TUPLE_ELEM(3, 2, NDNBOOST_PP_SEQ_FOLD_LEFT_ ## s(NDNBOOST_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq))) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 46 | # endif |
| 47 | # |
| 48 | # endif |