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_EQUAL_COMMON_HPP)
0008 #define BOOST_VMD_DETAIL_EQUAL_COMMON_HPP
0009 
0010 #include <boost/preprocessor/cat.hpp>
0011 #include <boost/preprocessor/comparison/equal.hpp>
0012 #include <boost/preprocessor/comparison/not_equal.hpp>
0013 #include <boost/preprocessor/control/iif.hpp>
0014 #include <boost/preprocessor/logical/bitand.hpp>
0015 #include <boost/preprocessor/logical/bitor.hpp>
0016 #include <boost/preprocessor/logical/bitxor.hpp>
0017 #include <boost/preprocessor/logical/compl.hpp>
0018 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0019 #include <boost/preprocessor/tuple/size.hpp>
0020 #include <boost/vmd/get_type.hpp>
0021 #include <boost/vmd/identity.hpp>
0022 #include <boost/vmd/is_empty.hpp>
0023 #include <boost/vmd/detail/match_single_identifier.hpp>
0024 #include <boost/vmd/detail/equal_type.hpp>
0025 
0026 #define BOOST_VMD_DETAIL_EQUAL_CONCAT_1 (1)
0027 
0028 #define BOOST_VMD_DETAIL_EQUAL_IS_1(res) \
0029     BOOST_PP_IS_BEGIN_PARENS \
0030         ( \
0031         BOOST_PP_CAT \
0032             ( \
0033             BOOST_VMD_DETAIL_EQUAL_CONCAT_, \
0034             res \
0035             ) \
0036         ) \
0037 /**/
0038 
0039 #define BOOST_VMD_DETAIL_EQUAL_MATCH_SINGLE_IDENTIFIER(d,vseq1,vseq2) \
0040     BOOST_VMD_DETAIL_MATCH_SINGLE_IDENTIFIER(vseq1,vseq2) \
0041 /**/
0042 
0043 #define BOOST_VMD_DETAIL_EQUAL_CNI_SMP(vseq1,vseq2,vtype) \
0044     BOOST_PP_IIF \
0045         ( \
0046         BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_NUMBER), \
0047         BOOST_PP_EQUAL, \
0048         BOOST_PP_IIF \
0049             ( \
0050             BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_TYPE), \
0051             BOOST_VMD_DETAIL_EQUAL_TYPE, \
0052             BOOST_VMD_DETAIL_MATCH_SINGLE_IDENTIFIER \
0053             ) \
0054         ) \
0055     (vseq1,vseq2) \
0056 /**/
0057 
0058 #define BOOST_VMD_DETAIL_EQUAL_CNI_SMP_D(d,vseq1,vseq2,vtype) \
0059     BOOST_PP_IIF \
0060         ( \
0061         BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_NUMBER), \
0062         BOOST_PP_EQUAL_D, \
0063         BOOST_PP_IIF \
0064             ( \
0065             BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_TYPE), \
0066             BOOST_VMD_DETAIL_EQUAL_TYPE_D, \
0067             BOOST_VMD_DETAIL_EQUAL_MATCH_SINGLE_IDENTIFIER \
0068             ) \
0069         ) \
0070     (d,vseq1,vseq2) \
0071 /**/
0072 
0073 #define BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_SIZE(vseq1,vseq2) \
0074     BOOST_PP_NOT_EQUAL \
0075         ( \
0076         BOOST_PP_TUPLE_SIZE(vseq1), \
0077         BOOST_PP_TUPLE_SIZE(vseq2) \
0078         ) \
0079 /**/
0080 
0081 #define BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_SIZE_D(d,vseq1,vseq2) \
0082     BOOST_PP_NOT_EQUAL_D \
0083         ( \
0084         d, \
0085         BOOST_PP_TUPLE_SIZE(vseq1), \
0086         BOOST_PP_TUPLE_SIZE(vseq2) \
0087         ) \
0088 /**/
0089 
0090 #define BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH(vseq1,vseq2,vtype1,vtype2) \
0091     BOOST_VMD_IDENTITY_RESULT \
0092         ( \
0093         BOOST_PP_IIF \
0094             ( \
0095             BOOST_PP_BITAND \
0096                 ( \
0097                 BOOST_VMD_DETAIL_EQUAL_TYPE(vtype1,BOOST_VMD_TYPE_TUPLE), \
0098                 BOOST_VMD_DETAIL_EQUAL_TYPE(vtype2,BOOST_VMD_TYPE_TUPLE) \
0099                 ), \
0100             BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_SIZE, \
0101             BOOST_VMD_IDENTITY(0) \
0102             ) \
0103         (vseq1,vseq2) \
0104         ) \
0105 /**/
0106 
0107 #define BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_D(d,vseq1,vseq2,vtype1,vtype2) \
0108     BOOST_VMD_IDENTITY_RESULT \
0109         ( \
0110         BOOST_PP_IIF \
0111             ( \
0112             BOOST_PP_BITAND \
0113                 ( \
0114                 BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype1,BOOST_VMD_TYPE_TUPLE), \
0115                 BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype2,BOOST_VMD_TYPE_TUPLE) \
0116                 ), \
0117             BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_SIZE_D, \
0118             BOOST_VMD_IDENTITY(0) \
0119             ) \
0120         (d,vseq1,vseq2) \
0121         ) \
0122 /**/
0123 
0124 #define BOOST_VMD_DETAIL_EQUAL_BOTH_EMPTY(...) 1
0125 
0126 #define BOOST_VMD_DETAIL_EQUAL_CHK_MATCH(bp1,bp2) \
0127     BOOST_PP_COMPL \
0128         ( \
0129         BOOST_PP_BITXOR \
0130             ( \
0131             bp1, \
0132             bp2 \
0133             ) \
0134         ) \
0135 /**/
0136 
0137 #define BOOST_VMD_DETAIL_EQUAL_CHK_PARENS_MATCH(vseq1,vseq2) \
0138     BOOST_VMD_DETAIL_EQUAL_CHK_MATCH \
0139         ( \
0140         BOOST_PP_IS_BEGIN_PARENS(vseq1), \
0141         BOOST_PP_IS_BEGIN_PARENS(vseq2) \
0142         ) \
0143 /**/
0144 
0145 #define BOOST_VMD_DETAIL_EQUAL_CHK_EMPTY_MATCH(vseq1,vseq2) \
0146     BOOST_VMD_DETAIL_EQUAL_CHK_MATCH \
0147         ( \
0148         BOOST_VMD_IS_EMPTY(vseq1), \
0149         BOOST_VMD_IS_EMPTY(vseq2) \
0150         ) \
0151 /**/
0152 
0153 #endif /* BOOST_VMD_DETAIL_EQUAL_COMMON_HPP */