File indexing completed on 2025-01-18 09:30:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_FLYWEIGHT_DETAIL_DYN_PERFECT_FWD_HPP
0010 #define BOOST_FLYWEIGHT_DETAIL_DYN_PERFECT_FWD_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/config.hpp>
0017
0018 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
0019
0020 #include <boost/preprocessor/arithmetic/add.hpp>
0021 #include <boost/preprocessor/cat.hpp>
0022 #include <boost/preprocessor/repetition/enum.hpp>
0023 #include <boost/preprocessor/repetition/enum_params.hpp>
0024 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0025 #include <boost/preprocessor/seq/seq.hpp>
0026
0027 #define BOOST_FLYWEIGHT_PERFECT_FWD_ARG(z,n,_) \
0028 BOOST_PP_CAT(T,n)&& BOOST_PP_CAT(t,n)
0029
0030 #define BOOST_FLYWEIGHT_PERFECT_FWD_N_AUX(n,name,body) \
0031 template<BOOST_PP_ENUM_PARAMS(n,typename T)> \
0032 name(BOOST_PP_ENUM(n,BOOST_FLYWEIGHT_PERFECT_FWD_ARG,~)) \
0033 body((FORWARD)(n))
0034
0035 #define BOOST_FLYWEIGHT_PERFECT_FWD_N(z,n,data) \
0036 BOOST_FLYWEIGHT_PERFECT_FWD_N_AUX( \
0037 n,BOOST_PP_SEQ_HEAD(data), \
0038 BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(data)))
0039
0040 #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
0041 BOOST_PP_REPEAT_FROM_TO( \
0042 1,BOOST_PP_ADD(BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS,1), \
0043 BOOST_FLYWEIGHT_PERFECT_FWD_N,(name)(body))
0044
0045 #define BOOST_FLYWEIGHT_PERFECT_FWD(name,body) \
0046 name()body((ENUM)(0)) \
0047 BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body)
0048
0049 #else
0050
0051
0052
0053 #include <boost/preprocessor/arithmetic/add.hpp>
0054 #include <boost/preprocessor/cat.hpp>
0055 #include <boost/preprocessor/repetition/enum.hpp>
0056 #include <boost/preprocessor/repetition/enum_params.hpp>
0057 #include <boost/preprocessor/repetition/repeat.hpp>
0058 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0059 #include <boost/preprocessor/seq/elem.hpp>
0060 #include <boost/preprocessor/seq/for_each_product.hpp>
0061 #include <boost/preprocessor/seq/seq.hpp>
0062 #include <boost/preprocessor/seq/size.hpp>
0063
0064 #define BOOST_FLYWEIGHT_CONST(b) BOOST_PP_CAT(BOOST_FLYWEIGHT_CONST,b)
0065 #define BOOST_FLYWEIGHT_CONST0
0066 #define BOOST_FLYWEIGHT_CONST1 const
0067
0068
0069
0070
0071
0072 #define BOOST_FLYWEIGHT_PERFECT_FWD_ARG(z,n,mask) \
0073 BOOST_FLYWEIGHT_CONST(BOOST_PP_SEQ_ELEM(n,mask)) \
0074 BOOST_PP_CAT(T,n)& BOOST_PP_CAT(t,n)
0075
0076
0077
0078
0079
0080 #define BOOST_FLYWEIGHT_PERFECT_FWD_MASK_AUX(r,name,body,mask) \
0081 template<BOOST_PP_ENUM_PARAMS(BOOST_PP_SEQ_SIZE(mask),typename T)> \
0082 name( \
0083 BOOST_PP_ENUM( \
0084 BOOST_PP_SEQ_SIZE(mask),BOOST_FLYWEIGHT_PERFECT_FWD_ARG,mask)) \
0085 body((ENUM)(BOOST_PP_SEQ_SIZE(mask)))
0086
0087 #define BOOST_FLYWEIGHT_PERFECT_FWD_MASK(r,data) \
0088 BOOST_FLYWEIGHT_PERFECT_FWD_MASK_AUX( \
0089 r, \
0090 BOOST_PP_SEQ_ELEM(0,BOOST_PP_SEQ_HEAD(data)), \
0091 BOOST_PP_SEQ_ELEM(1,BOOST_PP_SEQ_HEAD(data)), \
0092 BOOST_PP_SEQ_TAIL(data))
0093
0094 #define BOOST_FLYWEIGHT_01(z,n,_) ((0)(1))
0095
0096
0097
0098 #define BOOST_FLYWEIGHT_PERFECT_FWD_N(z,n,data) \
0099 BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
0100 BOOST_FLYWEIGHT_PERFECT_FWD_MASK, \
0101 ((data)) \
0102 BOOST_PP_REPEAT(n,BOOST_FLYWEIGHT_01,~))
0103
0104 #define BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body) \
0105 BOOST_PP_REPEAT_FROM_TO( \
0106 1,BOOST_PP_ADD(BOOST_FLYWEIGHT_LIMIT_PERFECT_FWD_ARGS,1), \
0107 BOOST_FLYWEIGHT_PERFECT_FWD_N,(name)(body))
0108
0109 #define BOOST_FLYWEIGHT_PERFECT_FWD(name,body) \
0110 name()body((ENUM)(0)) \
0111 BOOST_FLYWEIGHT_PERFECT_FWD_WITH_ARGS(name,body)
0112
0113 #endif
0114 #endif