File indexing completed on 2025-01-18 09:39:14
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_HPP_
0009 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_HPP_
0010
0011 #include <boost/local_function/aux_/symbol.hpp>
0012 #include <boost/local_function/aux_/preprocessor/traits/decl_returns.hpp>
0013 #include <boost/scope_exit.hpp>
0014 #include <boost/typeof/typeof.hpp>
0015 #include <boost/type_traits/remove_pointer.hpp>
0016 #include <boost/type_traits/function_traits.hpp>
0017 #include <boost/preprocessor/control/iif.hpp>
0018 #include <boost/preprocessor/control/expr_iif.hpp>
0019 #include <boost/preprocessor/list/adt.hpp>
0020 #include <boost/preprocessor/cat.hpp>
0021
0022
0023
0024 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id) \
0025 \
0026 BOOST_PP_CAT( \
0027 ERROR_missing_result_type_before_the_local_function_parameter_macro_id, \
0028 id)
0029
0030 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) \
0031 BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_params)(id) )
0032
0033 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
0034 BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (result_type)(id) )
0035
0036 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_ \
0037 \
0038 \
0039 \
0040 \
0041 result
0042
0043
0044 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DEDUCE_( \
0045 id, typename01, decl_traits) \
0046 \
0047 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL(id) \
0048 \
0049 \
0050 \
0051 BOOST_SCOPE_EXIT_DETAIL_TAG_DECL(0, \
0052 id, BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
0053 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
0054 BOOST_SCOPE_EXIT_DETAIL_CAPTURE_DECL(0, \
0055 ( id, BOOST_PP_EXPR_IIF(typename01, typename) ), \
0056 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
0057 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
0058 \
0059 struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
0060 typedef \
0061 BOOST_PP_EXPR_IIF(typename01, typename) \
0062 ::boost::function_traits< \
0063 BOOST_PP_EXPR_IIF(typename01, typename) \
0064 ::boost::remove_pointer< \
0065 BOOST_SCOPE_EXIT_DETAIL_CAPTURE_T(id, \
0066 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
0067 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
0068 >::type \
0069 >::result_type \
0070 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
0071 ; \
0072 };
0073
0074
0075
0076 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPED_( \
0077 id, typename01, decl_traits) \
0078 \
0079 struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
0080 typedef \
0081 BOOST_PP_LIST_FIRST( \
0082 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS( \
0083 decl_traits)) \
0084 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
0085 ; \
0086 };
0087
0088
0089
0090 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE(id, typename01) \
0091 BOOST_PP_EXPR_IIF(typename01, typename) \
0092 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) :: \
0093 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id)
0094
0095 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL(id) \
0096 (*BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id))();
0097
0098 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT(id, typename01, decl_traits) \
0099 BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS( \
0100 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits)), \
0101 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPED_ \
0102 , \
0103 BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DEDUCE_ \
0104 )(id, typename01, decl_traits)
0105
0106 #endif
0107