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 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_TUPLE_HPP)
0008 #define BOOST_VMD_DETAIL_TUPLE_HPP
0009 
0010 #include <boost/preprocessor/comparison/equal.hpp>
0011 #include <boost/preprocessor/control/iif.hpp>
0012 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0013 #include <boost/preprocessor/tuple/size.hpp>
0014 #include <boost/preprocessor/variadic/elem.hpp>
0015 #include <boost/vmd/empty.hpp>
0016 #include <boost/vmd/is_empty.hpp>
0017 #include <boost/vmd/identity.hpp>
0018 #include <boost/vmd/detail/empty_result.hpp>
0019 #include <boost/vmd/detail/mods.hpp>
0020 #include <boost/vmd/detail/parens.hpp>
0021   
0022 #define BOOST_VMD_DETAIL_TUPLE_BST_CS(vseq) \
0023     BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_BEGIN_PARENS(vseq)),1) \
0024 /**/
0025 
0026 #define BOOST_VMD_DETAIL_TUPLE_BST_CS_D(d,vseq) \
0027     BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(BOOST_VMD_DETAIL_BEGIN_PARENS(vseq)),1) \
0028 /**/
0029 
0030 #define BOOST_VMD_DETAIL_TUPLE_BST(vseq) \
0031     BOOST_VMD_IDENTITY_RESULT \
0032         ( \
0033         BOOST_PP_IIF \
0034             ( \
0035             BOOST_PP_IS_BEGIN_PARENS(vseq), \
0036             BOOST_VMD_DETAIL_TUPLE_BST_CS, \
0037             BOOST_VMD_IDENTITY(0) \
0038             ) \
0039         (vseq) \
0040         ) \
0041 /**/
0042 
0043 #define BOOST_VMD_DETAIL_TUPLE_BST_D(d,vseq) \
0044     BOOST_VMD_IDENTITY_RESULT \
0045         ( \
0046         BOOST_PP_IIF \
0047             ( \
0048             BOOST_PP_IS_BEGIN_PARENS(vseq), \
0049             BOOST_VMD_DETAIL_TUPLE_BST_CS_D, \
0050             BOOST_VMD_IDENTITY(0) \
0051             ) \
0052         (d,vseq) \
0053         ) \
0054 /**/
0055 
0056 #define BOOST_VMD_DETAIL_TUPLE_BSEQ_NXT(vseq) \
0057     BOOST_VMD_DETAIL_TUPLE_BST(BOOST_VMD_DETAIL_AFTER_PARENS_DATA(vseq)) \
0058 /**/
0059 
0060 #define BOOST_VMD_DETAIL_TUPLE_BSEQ_NXT_D(d,vseq) \
0061     BOOST_VMD_DETAIL_TUPLE_BST_D(d,BOOST_VMD_DETAIL_AFTER_PARENS_DATA(vseq)) \
0062 /**/
0063 
0064 #define BOOST_VMD_DETAIL_TUPLE_BSEQ(vseq) \
0065     BOOST_VMD_IDENTITY_RESULT \
0066         ( \
0067         BOOST_PP_IIF \
0068             ( \
0069             BOOST_VMD_DETAIL_TUPLE_BST(vseq), \
0070             BOOST_VMD_DETAIL_TUPLE_BSEQ_NXT, \
0071             BOOST_VMD_IDENTITY(0) \
0072             ) \
0073         (vseq) \
0074         ) \
0075 /**/
0076 
0077 #define BOOST_VMD_DETAIL_TUPLE_BSEQ_D(d,vseq) \
0078     BOOST_VMD_IDENTITY_RESULT \
0079         ( \
0080         BOOST_PP_IIF \
0081             ( \
0082             BOOST_VMD_DETAIL_TUPLE_BST_D(d,vseq), \
0083             BOOST_VMD_DETAIL_TUPLE_BSEQ_NXT_D, \
0084             BOOST_VMD_IDENTITY(0) \
0085             ) \
0086         (d,vseq) \
0087         ) \
0088 /**/
0089 
0090 #define BOOST_VMD_DETAIL_TUPLE_SPLIT_CHK_SEQ(vseq) \
0091     BOOST_PP_IIF \
0092         ( \
0093         BOOST_VMD_DETAIL_TUPLE_BSEQ(vseq), \
0094         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0095         BOOST_VMD_DETAIL_SPLIT_PARENS \
0096         ) \
0097     (vseq) \
0098 /**/
0099 
0100 #define BOOST_VMD_DETAIL_TUPLE_SPLIT_CHK_SEQ_D(d,vseq) \
0101     BOOST_PP_IIF \
0102         ( \
0103         BOOST_VMD_DETAIL_TUPLE_BSEQ_D(d,vseq), \
0104         BOOST_VMD_DETAIL_EMPTY_RESULT, \
0105         BOOST_VMD_DETAIL_SPLIT_PARENS \
0106         ) \
0107     (vseq) \
0108 /**/
0109 
0110 #define BOOST_VMD_DETAIL_TUPLE_SPLIT(vseq) \
0111     BOOST_PP_IIF \
0112       ( \
0113       BOOST_PP_IS_BEGIN_PARENS(vseq), \
0114       BOOST_VMD_DETAIL_TUPLE_SPLIT_CHK_SEQ, \
0115       BOOST_VMD_DETAIL_EMPTY_RESULT \
0116       ) \
0117     (vseq) \
0118 /**/
0119 
0120 #define BOOST_VMD_DETAIL_TUPLE_SPLIT_D(d,vseq) \
0121     BOOST_PP_IIF \
0122       ( \
0123       BOOST_PP_IS_BEGIN_PARENS(vseq), \
0124       BOOST_VMD_DETAIL_TUPLE_SPLIT_CHK_SEQ_D, \
0125       BOOST_VMD_DETAIL_EMPTY_RESULT \
0126       ) \
0127     (d,vseq) \
0128 /**/
0129 
0130 #define BOOST_VMD_DETAIL_TUPLE_PROCESS_CHK_SEQ(vseq) \
0131     BOOST_PP_IIF \
0132         ( \
0133         BOOST_VMD_DETAIL_TUPLE_BSEQ(vseq), \
0134         BOOST_VMD_EMPTY, \
0135         BOOST_VMD_DETAIL_BEGIN_PARENS \
0136         ) \
0137     (vseq) \
0138 /**/
0139 
0140 #define BOOST_VMD_DETAIL_TUPLE_PROCESS_CHK_SEQ_D(d,vseq) \
0141     BOOST_PP_IIF \
0142         ( \
0143         BOOST_VMD_DETAIL_TUPLE_BSEQ_D(d,vseq), \
0144         BOOST_VMD_EMPTY, \
0145         BOOST_VMD_DETAIL_BEGIN_PARENS \
0146         ) \
0147     (vseq) \
0148 /**/
0149 
0150 #define BOOST_VMD_DETAIL_TUPLE_PROCESS(vseq) \
0151     BOOST_PP_IIF \
0152       ( \
0153       BOOST_PP_IS_BEGIN_PARENS(vseq), \
0154       BOOST_VMD_DETAIL_TUPLE_PROCESS_CHK_SEQ, \
0155       BOOST_VMD_EMPTY \
0156       ) \
0157     (vseq) \
0158 /**/
0159 
0160 #define BOOST_VMD_DETAIL_TUPLE_PROCESS_D(d,vseq) \
0161     BOOST_PP_IIF \
0162       ( \
0163       BOOST_PP_IS_BEGIN_PARENS(vseq), \
0164       BOOST_VMD_DETAIL_TUPLE_PROCESS_CHK_SEQ_D, \
0165       BOOST_VMD_EMPTY \
0166       ) \
0167     (d,vseq) \
0168 /**/
0169 
0170 #define BOOST_VMD_DETAIL_TUPLE(...) \
0171     BOOST_PP_IIF \
0172         ( \
0173         BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER \
0174             ( \
0175             BOOST_VMD_DETAIL_NEW_MODS(BOOST_VMD_ALLOW_AFTER,__VA_ARGS__) \
0176             ), \
0177         BOOST_VMD_DETAIL_TUPLE_SPLIT, \
0178         BOOST_VMD_DETAIL_TUPLE_PROCESS \
0179         ) \
0180     (BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
0181 /**/
0182 
0183 #define BOOST_VMD_DETAIL_TUPLE_D(d,...) \
0184     BOOST_PP_IIF \
0185         ( \
0186         BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER \
0187             ( \
0188             BOOST_VMD_DETAIL_NEW_MODS(BOOST_VMD_ALLOW_AFTER,__VA_ARGS__) \
0189             ), \
0190         BOOST_VMD_DETAIL_TUPLE_SPLIT_D, \
0191         BOOST_VMD_DETAIL_TUPLE_PROCESS_D \
0192         ) \
0193     (d,BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
0194 /**/
0195 
0196 #endif /* BOOST_VMD_DETAIL_TUPLE_HPP */