1 | # /* ************************************************************************** |
2 | # * * |
3 | # * (C) Copyright Edward Diener 2013. |
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 | # |
12 | # ifndef BOOST_PREPROCESSOR_TUPLE_POP_FRONT_HPP |
13 | # define BOOST_PREPROCESSOR_TUPLE_POP_FRONT_HPP |
14 | # |
15 | # include <boost/preprocessor/config/config.hpp> |
16 | # |
17 | # if BOOST_PP_VARIADICS |
18 | # |
19 | # include <boost/preprocessor/array/pop_front.hpp> |
20 | # include <boost/preprocessor/array/to_tuple.hpp> |
21 | # include <boost/preprocessor/comparison/greater.hpp> |
22 | # include <boost/preprocessor/control/iif.hpp> |
23 | # include <boost/preprocessor/tuple/size.hpp> |
24 | # include <boost/preprocessor/tuple/to_array.hpp> |
25 | # |
26 | # |
27 | # /* BOOST_PP_TUPLE_POP_FRONT */ |
28 | # |
29 | # define BOOST_PP_TUPLE_POP_FRONT(tuple) \ |
30 | BOOST_PP_IIF \ |
31 | ( \ |
32 | BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \ |
33 | BOOST_PP_TUPLE_POP_FRONT_EXEC, \ |
34 | BOOST_PP_TUPLE_POP_FRONT_RETURN \ |
35 | ) \ |
36 | (tuple) \ |
37 | /**/ |
38 | # |
39 | # define BOOST_PP_TUPLE_POP_FRONT_EXEC(tuple) \ |
40 | BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_FRONT(BOOST_PP_TUPLE_TO_ARRAY(tuple))) \ |
41 | /**/ |
42 | # |
43 | # define BOOST_PP_TUPLE_POP_FRONT_RETURN(tuple) tuple |
44 | # |
45 | # /* BOOST_PP_TUPLE_POP_FRONT_Z */ |
46 | # |
47 | # define BOOST_PP_TUPLE_POP_FRONT_Z(z, tuple) \ |
48 | BOOST_PP_IIF \ |
49 | ( \ |
50 | BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(tuple),1), \ |
51 | BOOST_PP_TUPLE_POP_FRONT_Z_EXEC, \ |
52 | BOOST_PP_TUPLE_POP_FRONT_Z_RETURN \ |
53 | ) \ |
54 | (z, tuple) \ |
55 | /**/ |
56 | # |
57 | # define BOOST_PP_TUPLE_POP_FRONT_Z_EXEC(z, tuple) \ |
58 | BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_FRONT_Z(z, BOOST_PP_TUPLE_TO_ARRAY(tuple))) \ |
59 | /**/ |
60 | # |
61 | # define BOOST_PP_TUPLE_POP_FRONT_Z_RETURN(z, tuple) tuple |
62 | # |
63 | # endif // BOOST_PP_VARIADICS |
64 | # |
65 | # endif // BOOST_PREPROCESSOR_TUPLE_POP_FRONT_HPP |
66 | |