|
||||
File indexing completed on 2025-01-30 09:44:55
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_CONFIG_HPP_ 0009 #define BOOST_LOCAL_FUNCTION_CONFIG_HPP_ 0010 0011 #ifndef DOXYGEN 0012 0013 #include <boost/config.hpp> 0014 0015 #ifndef BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX 0016 # define BOOST_LOCAL_FUNCTION_CONFIG_FUNCTION_ARITY_MAX 5 0017 #endif 0018 0019 #ifndef BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX 0020 # define BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX 10 0021 #endif 0022 0023 #ifndef BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 0024 # ifdef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS 0025 # define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 0 0026 # else 0027 # define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 1 0028 # endif 0029 #elif BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS // If true, force it to 1. 0030 # undef BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 0031 # define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 1 0032 #endif 0033 0034 #else // DOXYGEN 0035 0036 /** @file 0037 @brief Configuration macros allow to change the behaviour of this library at 0038 compile-time. 0039 */ 0040 0041 /** 0042 @brief Maximum number of parameters supported by local functions. 0043 0044 If programmers leave this configuration macro undefined, its default 0045 value is <c>5</c> (increasing this number might increase compilation time). 0046 When defined by programmers, this macro must be a non-negative integer number. 0047 0048 @Note This macro specifies the maximum number of local function parameters 0049 excluding bound variables (which are instead specified by 0050 @RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX}). 0051 0052 @See @RefSect{tutorial, Tutorial} section, 0053 @RefSect{getting_started, Getting Started} section, 0054 @RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX}. 0055 */ 0056 #define BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX 0057 0058 /** 0059 @brief Maximum number of bound variables supported by local functions. 0060 0061 If programmers leave this configuration macro undefined, its default 0062 value is <c>10</c> (increasing this number might increase compilation time). 0063 When defined by programmers, this macro must be a non-negative integer number. 0064 0065 @Note This macro specifies the maximum number of bound variables excluding 0066 local function parameters (which are instead specified by 0067 @RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX}). 0068 0069 @See @RefSect{tutorial, Tutorial} section, 0070 @RefSect{getting_started, Getting Started} section, 0071 @RefMacro{BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX}. 0072 */ 0073 #define BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX 0074 0075 /** 0076 @brief Specify when local functions can be passed as template parameters 0077 without introducing any run-time overhead. 0078 0079 If this macro is defined to <c>1</c>, this library will assume that the 0080 compiler allows to pass local classes as template parameters: 0081 @code 0082 template<typename T> void f(void) {} 0083 0084 int main(void) { 0085 struct local_class {}; 0086 f<local_class>(); 0087 return 0; 0088 } 0089 @endcode 0090 This is the case for C++11 compilers and some C++03 compilers (e.g., MSVC), but 0091 it is not the case in general for most C++03 compilers (including GCC). 0092 This will allow the library to pass local functions as template parameters 0093 without introducing any run-time overhead (specifically without preventing the 0094 compiler from optimizing local function calls by inlining their assembly code). 0095 0096 If this macro is defined to <c>0</c> instead, this library will introduce 0097 a run-time overhead associated to resolving a function pointer call in order to 0098 still allow to pass the local functions as template parameters. 0099 0100 It is recommended to leave this macro undefined. 0101 In this case, the library will automatically define this macro to <c>0</c> if 0102 the Boost.Config macro <c>BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS</c> is 0103 defined for the specific compiler, and to <c>1</c> otherwise. 0104 0105 @See @RefSect{getting_started, Getting Started} section, 0106 @RefSect{advanced_topics, Advanced Topics} section, 0107 @RefMacro{BOOST_LOCAL_FUNCTION_NAME}. 0108 */ 0109 #define BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS 0110 0111 #endif // DOXYGEN 0112 0113 #endif // #include guard 0114
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |