Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 //  (C) Copyright Edward Diener 2011-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_DETAIL_LIST_HPP)
0008 #define BOOST_VMD_DETAIL_LIST_HPP
0009 
0010 #include <boost/preprocessor/control/iif.hpp>
0011 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0012 #include <boost/preprocessor/tuple/elem.hpp>
0013 #include <boost/preprocessor/tuple/pop_back.hpp>
0014 #include <boost/preprocessor/variadic/elem.hpp>
0015 #include <boost/vmd/is_empty.hpp>
0016 #include <boost/vmd/detail/empty_result.hpp>
0017 #include <boost/vmd/detail/identifier.hpp>
0018 #include <boost/vmd/detail/is_list.hpp>
0019 #include <boost/vmd/detail/mods.hpp>
0020 #include <boost/vmd/detail/parens.hpp>
0021 
0022 #define BOOST_VMD_DETAIL_LIST_CHECK_FOR_LIST(tuple) \
0023     BOOST_PP_IIF \
0024         ( \
0025         BOOST_VMD_DETAIL_IS_LIST \
0026             ( \
0027             BOOST_PP_TUPLE_ELEM \
0028                 ( \
0029                 0, \
0030                 tuple \
0031                 ) \
0032             ), \
0033         tuple, \
0034         (,) \
0035         ) \
0036 /**/
0037 
0038 #define BOOST_VMD_DETAIL_LIST_CHECK_FOR_LIST_D(d,tuple) \
0039     BOOST_PP_IIF \
0040         ( \
0041         BOOST_VMD_DETAIL_IS_LIST_D \
0042             ( \
0043             d, \
0044             BOOST_PP_TUPLE_ELEM \
0045                 ( \
0046                 0, \
0047                 tuple \
0048                 ) \
0049             ), \
0050         tuple, \
0051         (,) \
0052         ) \
0053 /**/
0054 
0055 #define BOOST_VMD_DETAIL_LIST_CHECK_RETURN(tuple) \
0056     BOOST_PP_IIF \
0057         ( \
0058         BOOST_VMD_IS_EMPTY \
0059             ( \
0060             BOOST_PP_TUPLE_ELEM \
0061                 ( \
0062                 0, \
0063                 tuple \
0064                 ) \
0065             ), \
0066         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0067         BOOST_VMD_DETAIL_LIST_CHECK_FOR_LIST \
0068         ) \
0069     (tuple) \
0070 /**/
0071 
0072 #define BOOST_VMD_DETAIL_LIST_CHECK_RETURN_D(d,tuple) \
0073     BOOST_PP_IIF \
0074         ( \
0075         BOOST_VMD_IS_EMPTY \
0076             ( \
0077             BOOST_PP_TUPLE_ELEM \
0078                 ( \
0079                 0, \
0080                 tuple \
0081                 ) \
0082             ), \
0083         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0084         BOOST_VMD_DETAIL_LIST_CHECK_FOR_LIST_D \
0085         ) \
0086     (d,tuple) \
0087 /**/
0088 
0089 #define BOOST_VMD_DETAIL_LIST_EMPTY_LIST(list) \
0090     BOOST_VMD_DETAIL_IDENTIFIER(list,BOOST_PP_NIL,BOOST_VMD_RETURN_AFTER,BOOST_VMD_RETURN_INDEX) \
0091 /**/
0092 
0093 #define BOOST_VMD_DETAIL_LIST_EMPTY_LIST_D(d,list) \
0094     BOOST_VMD_DETAIL_IDENTIFIER_D(d,list,BOOST_PP_NIL,BOOST_VMD_RETURN_AFTER,BOOST_VMD_RETURN_INDEX) \
0095 /**/
0096 
0097 #define BOOST_VMD_DETAIL_LIST_TUPLE(param) \
0098     BOOST_VMD_DETAIL_LIST_CHECK_RETURN \
0099         ( \
0100         BOOST_VMD_DETAIL_PARENS(param,BOOST_VMD_RETURN_AFTER) \
0101         ) \
0102 /**/
0103 
0104 #define BOOST_VMD_DETAIL_LIST_TUPLE_D(d,param) \
0105     BOOST_VMD_DETAIL_LIST_CHECK_RETURN_D \
0106         ( \
0107         d, \
0108         BOOST_VMD_DETAIL_PARENS_D(d,param,BOOST_VMD_RETURN_AFTER) \
0109         ) \
0110 /**/
0111 
0112 #define BOOST_VMD_DETAIL_LIST_EMPTY_PROCESS(tuple) \
0113     BOOST_PP_IIF \
0114         ( \
0115         BOOST_VMD_IS_EMPTY \
0116             ( \
0117             BOOST_PP_TUPLE_ELEM(0,tuple) \
0118             ), \
0119         (,), \
0120         tuple \
0121         ) \
0122 /**/
0123 
0124 #define BOOST_VMD_DETAIL_LIST_EMPTY(list) \
0125     BOOST_VMD_DETAIL_LIST_EMPTY_PROCESS \
0126         ( \
0127         BOOST_VMD_DETAIL_LIST_EMPTY_LIST(list) \
0128         ) \
0129 /**/
0130 
0131 #define BOOST_VMD_DETAIL_LIST_EMPTY_D(d,list) \
0132     BOOST_VMD_DETAIL_LIST_EMPTY_PROCESS \
0133         ( \
0134         BOOST_VMD_DETAIL_LIST_EMPTY_LIST_D(d,list) \
0135         ) \
0136 /**/
0137 
0138 #define BOOST_VMD_DETAIL_LIST_PROCESS(list) \
0139     BOOST_PP_IIF \
0140         ( \
0141         BOOST_PP_IS_BEGIN_PARENS(list), \
0142         BOOST_VMD_DETAIL_LIST_TUPLE, \
0143         BOOST_VMD_DETAIL_LIST_EMPTY \
0144         ) \
0145     (list) \
0146 /**/
0147 
0148 #define BOOST_VMD_DETAIL_LIST_SPLIT(list) \
0149     BOOST_PP_IIF \
0150         ( \
0151         BOOST_VMD_IS_EMPTY(list), \
0152         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0153         BOOST_VMD_DETAIL_LIST_PROCESS \
0154         ) \
0155     (list) \
0156 /**/
0157 
0158 #define BOOST_VMD_DETAIL_LIST_BEGIN(list) \
0159     BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_DETAIL_LIST_SPLIT(list)) \
0160 /**/
0161 
0162 #define BOOST_VMD_DETAIL_LIST_PROCESS_D(d,list) \
0163     BOOST_PP_IIF \
0164         ( \
0165         BOOST_PP_IS_BEGIN_PARENS(list), \
0166         BOOST_VMD_DETAIL_LIST_TUPLE_D, \
0167         BOOST_VMD_DETAIL_LIST_EMPTY_D \
0168         ) \
0169     (d,list) \
0170 /**/
0171 
0172 #define BOOST_VMD_DETAIL_LIST_SPLIT_D(d,list) \
0173     BOOST_PP_IIF \
0174         ( \
0175         BOOST_VMD_IS_EMPTY(list), \
0176         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0177         BOOST_VMD_DETAIL_LIST_PROCESS_D \
0178         ) \
0179     (d,list) \
0180 /**/
0181 
0182 #define BOOST_VMD_DETAIL_LIST_BEGIN_D(d,list) \
0183     BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_DETAIL_LIST_SPLIT_D(d,list)) \
0184 /**/
0185 
0186 #define BOOST_VMD_DETAIL_LIST_D(d,...) \
0187     BOOST_PP_IIF \
0188         ( \
0189         BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER \
0190             ( \
0191             BOOST_VMD_DETAIL_NEW_MODS_D(d,BOOST_VMD_ALLOW_AFTER,__VA_ARGS__) \
0192             ), \
0193         BOOST_VMD_DETAIL_LIST_SPLIT_D, \
0194         BOOST_VMD_DETAIL_LIST_BEGIN_D \
0195         ) \
0196     (d,BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
0197 /**/
0198 
0199 #define BOOST_VMD_DETAIL_LIST(...) \
0200     BOOST_PP_IIF \
0201         ( \
0202         BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER \
0203             ( \
0204             BOOST_VMD_DETAIL_NEW_MODS(BOOST_VMD_ALLOW_AFTER,__VA_ARGS__) \
0205             ), \
0206         BOOST_VMD_DETAIL_LIST_SPLIT, \
0207         BOOST_VMD_DETAIL_LIST_BEGIN \
0208         ) \
0209     (BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
0210 /**/
0211 
0212 #endif /* BOOST_VMD_DETAIL_LIST_HPP */