• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 //  (C) Copyright Edward Diener 2015
3 //  Use, modification and distribution are subject to the Boost Software License,
4 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 //  http://www.boost.org/LICENSE_1_0.txt).
6 
7 #if !defined(BOOST_VMD_TUPLE_POP_FRONT_HPP)
8 #define BOOST_VMD_TUPLE_POP_FRONT_HPP
9 
10 #include <boost/vmd/detail/setup.hpp>
11 
12 #if BOOST_PP_VARIADICS
13 
14 #include <boost/preprocessor/comparison/equal.hpp>
15 #include <boost/preprocessor/control/iif.hpp>
16 #include <boost/preprocessor/tuple/pop_front.hpp>
17 #include <boost/preprocessor/tuple/size.hpp>
18 #include <boost/vmd/empty.hpp>
19 
20 /*
21 
22   The succeeding comments in this file are in doxygen format.
23 
24 */
25 
26 /** \file
27 */
28 
29 /** \def BOOST_VMD_TUPLE_POP_FRONT(tuple)
30 
31     \brief pops an element from the front of a tuple.
32 
33     tuple = tuple to pop an element from.
34 
35     If the tuple is an empty tuple the result is undefined.
36     If the tuple is a single element the result is an empty tuple.
37     Otherwise the result is a tuple after removing the first element.
38 */
39 
40 #define BOOST_VMD_TUPLE_POP_FRONT(tuple) \
41     BOOST_PP_IIF \
42         ( \
43         BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \
44         BOOST_VMD_EMPTY, \
45         BOOST_PP_TUPLE_POP_FRONT \
46         ) \
47     (tuple) \
48 /**/
49 
50 /** \def BOOST_VMD_TUPLE_POP_FRONT_Z(z,tuple)
51 
52     \brief pops an element from the front of a tuple. It reenters BOOST_PP_REPEAT with maximum efficiency.
53 
54     z     = the next available BOOST_PP_REPEAT dimension. <br/>
55     tuple = tuple to pop an element from.
56 
57     If the tuple is an empty tuple the result is undefined.
58     If the tuple is a single element the result is an empty tuple.
59     Otherwise the result is a tuple after removing the first element.
60 */
61 
62 #define BOOST_VMD_TUPLE_POP_FRONT_Z(z,tuple) \
63     BOOST_PP_IIF \
64         ( \
65         BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \
66         BOOST_VMD_EMPTY, \
67         BOOST_PP_TUPLE_POP_FRONT_Z \
68         ) \
69     (z,tuple) \
70 /**/
71 
72 #endif /* BOOST_PP_VARIADICS */
73 #endif /* BOOST_VMD_TUPLE_POP_FRONT_HPP */
74