Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:38

0001 
0002 //  (C) Copyright Edward Diener 2015
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 
0007 #if !defined(BOOST_VMD_TUPLE_REMOVE_HPP)
0008 #define BOOST_VMD_TUPLE_REMOVE_HPP
0009 
0010 #include <boost/vmd/detail/setup.hpp>
0011 
0012 #if BOOST_PP_VARIADICS
0013 
0014 #include <boost/preprocessor/comparison/equal.hpp>
0015 #include <boost/preprocessor/control/iif.hpp>
0016 #include <boost/preprocessor/logical/bitand.hpp>
0017 #include <boost/preprocessor/tuple/remove.hpp>
0018 #include <boost/preprocessor/tuple/size.hpp>
0019 #include <boost/vmd/empty.hpp>
0020 
0021 /*
0022 
0023   The succeeding comments in this file are in doxygen format.
0024 
0025 */
0026 
0027 /** \file
0028 */
0029 
0030 /** \def BOOST_VMD_TUPLE_REMOVE(tuple,index)
0031 
0032     \brief removes an element from a tuple.
0033 
0034     tuple = tuple from which an element is to be removed. <br/>
0035     index = The zero-based position in tuple of the element to be removed.
0036 
0037     If index is greater or equal to the tuple size the result is undefined.
0038     If the tuple is a single element and the index is 0 the result is an empty tuple.
0039     Otherwise the result is a tuple after removing the index element.
0040 */
0041 
0042 #define BOOST_VMD_TUPLE_REMOVE(tuple,index) \
0043     BOOST_PP_IIF \
0044         ( \
0045         BOOST_PP_BITAND \
0046             ( \
0047             BOOST_PP_EQUAL(index,0), \
0048             BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1) \
0049             ), \
0050         BOOST_VMD_EMPTY, \
0051         BOOST_PP_TUPLE_REMOVE \
0052         ) \
0053     (tuple,index) \
0054 /**/
0055 
0056 /** \def BOOST_VMD_TUPLE_REMOVE_D(d,tuple,index)
0057 
0058     \brief removes an element from a tuple. It reenters BOOST_PP_WHILE with maximum efficiency.
0059 
0060     d     = The next available BOOST_PP_WHILE iteration. <br/>
0061     tuple = tuple from which an element is to be removed. <br/>
0062     index = The zero-based position in tuple of the element to be removed.
0063 
0064     If index is greater or equal to the tuple size the result is undefined.
0065     If the tuple is a single element and the index is 0 the result is an empty tuple.
0066     Otherwise the result is a tuple after removing the index element.
0067 */
0068 
0069 #define BOOST_VMD_TUPLE_REMOVE_D(d,tuple,index) \
0070     BOOST_PP_IIF \
0071         ( \
0072         BOOST_PP_BITAND \
0073             ( \
0074             BOOST_PP_EQUAL_D(d,index,0), \
0075             BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(tuple),1) \
0076             ), \
0077         BOOST_VMD_EMPTY, \
0078         BOOST_PP_TUPLE_REMOVE_D \
0079         ) \
0080     (d,tuple,index) \
0081 /**/
0082 
0083 #endif /* BOOST_PP_VARIADICS */
0084 #endif /* BOOST_VMD_TUPLE_REMOVE_HPP */