Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:54:14

0001 
0002 // Copyright (C) 2009-2012 Lorenzo Caminiti
0003 // Distributed under the Boost Software License, Version 1.0
0004 // (see accompanying file LICENSE_1_0.txt or a copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 // Home at http://www.boost.org/libs/local_function
0007 
0008 #ifndef BOOST_LOCAL_FUNCTION_AUX_DECL_HPP_
0009 #define BOOST_LOCAL_FUNCTION_AUX_DECL_HPP_
0010 
0011 #include <boost/local_function/aux_/macro/code_/result.hpp>
0012 #include <boost/local_function/aux_/macro/code_/bind.hpp>
0013 #include <boost/local_function/aux_/macro/code_/functor.hpp>
0014 #include <boost/local_function/aux_/preprocessor/traits/decl.hpp>
0015 #include <boost/local_function/aux_/preprocessor/traits/decl_error.hpp>
0016 #include <boost/scope_exit.hpp>
0017 #include <boost/mpl/assert.hpp>
0018 #include <boost/preprocessor/control/iif.hpp>
0019 #include <boost/preprocessor/facilities/is_empty.hpp>
0020 #include <boost/preprocessor/list/adt.hpp>
0021 #include <boost/preprocessor/tuple/eat.hpp>
0022 
0023 // PRIVATE //
0024 
0025 #define BOOST_LOCAL_FUNCTION_AUX_DECL_OK_(id, typename01, decl_traits) \
0026     BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT(id, typename01, decl_traits) \
0027     BOOST_LOCAL_FUNCTION_AUX_CODE_BIND(id, typename01, decl_traits) \
0028     BOOST_LOCAL_FUNCTION_AUX_CODE_FUNCTOR(id, typename01, decl_traits) 
0029 
0030 #define BOOST_LOCAL_FUNCTION_AUX_DECL_ERROR_(id, typename01, decl_traits) \
0031     BOOST_PP_IIF(BOOST_PP_LIST_IS_CONS( \
0032             BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits)), \
0033         /* return specified, so no result type before this macro expansion */ \
0034         BOOST_PP_TUPLE_EAT(1) \
0035     , \
0036         /* even if error, must declare result type to prevent additional */ \
0037         /* error due to result type appearing before this macro expansion */ \
0038         BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL \
0039     )(id) \
0040     ; /* close eventual previous statements, otherwise it has no effect */ \
0041     BOOST_MPL_ASSERT_MSG(false, /* always fails (there's an error) */ \
0042             BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_MSG(decl_traits), ())\
0043     ; /* must close ASSERT macro for eventual use within class scope */
0044 
0045 // PUBLIC //
0046 
0047 #define BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR \
0048     BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (args) )
0049 
0050 // Undefine local function bound args global variable. Actual declaration of
0051 // this variable is made using SFINAE mechanisms by each local function macro.
0052 extern boost::scope_exit::detail::undeclared
0053         BOOST_LOCAL_FUNCTION_AUX_DECL_ARGS_VAR;
0054 
0055 // sign_params: parsed parenthesized params.
0056 #define BOOST_LOCAL_FUNCTION_AUX_DECL(id, typename01, decl_traits) \
0057     BOOST_PP_IIF(BOOST_PP_IS_EMPTY( \
0058             BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_ERROR_MSG(decl_traits)), \
0059         BOOST_LOCAL_FUNCTION_AUX_DECL_OK_ \
0060     , \
0061         BOOST_LOCAL_FUNCTION_AUX_DECL_ERROR_ \
0062     )(id, typename01, decl_traits)
0063 
0064 #endif // #include guard
0065