Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:16

0001 // Boost.Range library
0002 //
0003 //  Copyright Neil Groves 2014. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 #define BOOST_RANGE_combined_exp_pred(d, data) BOOST_PP_TUPLE_ELEM(3, 0, data)
0011 
0012 #define BOOST_RANGE_combined_exp_op(d, data) \
0013  ( \
0014     BOOST_PP_DEC( \
0015        BOOST_PP_TUPLE_ELEM(3, 0, data) \
0016     ), \
0017     BOOST_PP_TUPLE_ELEM(3, 1, data), \
0018     BOOST_PP_MUL_D( \
0019        d, \
0020        BOOST_PP_TUPLE_ELEM(3, 2, data), \
0021        BOOST_PP_TUPLE_ELEM(3, 1, data) \
0022     ) \
0023  )
0024 
0025 #define BOOST_RANGE_combined_exp(x, n) \
0026   BOOST_PP_TUPLE_ELEM(3, 2, \
0027   BOOST_PP_WHILE(BOOST_RANGE_combined_exp_pred, \
0028                  BOOST_RANGE_combined_exp_op, (n, x, 1)))
0029 
0030 #define BOOST_RANGE_combined_bitset_pred(n, state) \
0031     BOOST_PP_TUPLE_ELEM(2,1,state)
0032 
0033 #define BOOST_RANGE_combined_bitset_op(d, state) \
0034     (BOOST_PP_DIV_D(d, BOOST_PP_TUPLE_ELEM(2,0,state), 2), \
0035      BOOST_PP_DEC(BOOST_PP_TUPLE_ELEM(2,1,state)))
0036 
0037 #define BOOST_RANGE_combined_bitset(i, n) \
0038 BOOST_PP_MOD(BOOST_PP_TUPLE_ELEM(2, 0, \
0039       BOOST_PP_WHILE(BOOST_RANGE_combined_bitset_pred, \
0040                      BOOST_RANGE_combined_bitset_op, (i,n))), 2)
0041 
0042 #define BOOST_RANGE_combined_range_iterator(z, n, i) \
0043   typename range_iterator< \
0044       BOOST_PP_CAT(R,n)          \
0045       BOOST_PP_IF( \
0046           BOOST_RANGE_combined_bitset(i,n), \
0047           BOOST_PP_IDENTITY(const), \
0048           BOOST_PP_EMPTY)() \
0049   >::type
0050 
0051 #define BOOST_RANGE_combined_args(z, n, i) \
0052   BOOST_PP_CAT(R, n) \
0053   BOOST_PP_IF(BOOST_RANGE_combined_bitset(i,n), const&, &)  \
0054   BOOST_PP_CAT(r, n)
0055 
0056 #define BOOST_RANGE_combine_impl(z, i, n)\
0057     template<BOOST_PP_ENUM_PARAMS(n, typename R)> \
0058     inline range::combined_range< \
0059         boost::tuple<BOOST_PP_ENUM(n, BOOST_RANGE_combined_range_iterator, i)> \
0060     > \
0061     combine(BOOST_PP_ENUM(n, BOOST_RANGE_combined_args, i)) \
0062     { \
0063         typedef tuple< \
0064             BOOST_PP_ENUM(n, BOOST_RANGE_combined_range_iterator, i) \
0065         > rng_tuple_t;   \
0066         return range::combined_range<rng_tuple_t>( \
0067             rng_tuple_t(BOOST_PP_ENUM(n, BOOST_RANGE_combined_seq, begin)), \
0068             rng_tuple_t(BOOST_PP_ENUM(n, BOOST_RANGE_combined_seq, end))); \
0069     }
0070 
0071 
0072 #define BOOST_RANGE_combine(z, n, data) \
0073   BOOST_PP_REPEAT(BOOST_RANGE_combined_exp(2,n), BOOST_RANGE_combine_impl, n)