From e379125fea161f4b3c323da9bc7d63c438825699 Mon Sep 17 00:00:00 2001
From: Lorenzo Caminiti If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number. If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload). This function template creates and returns an The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with The maximum number of functions to overload is given by the This function object aggregates together calls to functions of all the specified function types The maximum number of functions to overload is given by the See: Tutorial section, Any function pointer, function reference, and monomorphic function object that can be converted to a This will in turn invoke the call operator of the 1st function passed to the constructor. This will in turn invoke the call operator of the 2nd function passed to the constructor. Note: Similar call operators are present for all specified function types Last revised: February 14, 2012 at 16:16:51 GMT Last revised: February 17, 2012 at 20:42:39 GMT If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number. If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload). This function template creates and returns an The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with The maximum number of functions to overload is given by the This function object aggregates together calls to functions of all the specified function types The maximum number of functions to overload is given by the See: Tutorial section, Any function pointer, function reference, and monomorphic function object that can be converted to a This will in turn invoke the call operator of the 1st function passed to the constructor. This will in turn invoke the call operator of the 2nd function passed to the constructor. Note: Similar call operators are present for all specified function types
diff --git a/overloaded_function/doc/html/index.html b/overloaded_function/doc/html/index.html
index a2e0f0d..f900f8e 100644
--- a/overloaded_function/doc/html/index.html
+++ b/overloaded_function/doc/html/index.html
@@ -87,9 +87,9 @@
Last revised: February 17, 2012 at 20:42:39 GMT Last revised: February 20, 2012 at 20:10:59 GMT If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number. If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload). This function template creates and returns an The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with The maximum number of functions to overload is given by the This function object aggregates together calls to functions of all the specified function types The maximum number of functions to overload is given by the See: Tutorial section, Any function pointer, function reference, and monomorphic function object that can be converted to a This will in turn invoke the call operator of the 1st function passed to the constructor. This will in turn invoke the call operator of the 2nd function passed to the constructor. Note: Similar call operators are present for all specified function types
- The library was tested by the authors on GCC 4.5.3 (with and without C++11
- features
+ See the library regressions
+ test results for detailed information on supported compilers and
+ platforms.
-
+ [identity_decls]
This library header
The
-
+ [identity_decls]
Instead of calling them using their separate names (here
Last revised: February 20, 2012 at 20:10:59 GMT Last revised: March 22, 2012 at 20:51:03 GMT If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number. If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload). This function template creates and returns an The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with This function template creates and returns an The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with The maximum number of functions to overload is given by the Note: In this documentation, Note: In this documentation, See: Tutorial section, This function object aggregates together calls to functions of all the specified function types In some cases, the The maximum number of functions to overload is given by the This function object aggregates together calls to functions of all the specified function types Parameters:
+ In some cases, the At least two distinct function types must be specified (because there is nothing to overload between one or zero functions). The maximum number of functions to overload is given by the See: Tutorial section, Any function pointer, function reference, and monomorphic function object that can be converted to a Any function pointer, function reference, and monomorphic function object that can be converted to a Note: Unfortunately, it is not possible to support polymorphic function objects (as explained here). This will in turn invoke the call operator of the 1st function passed to the constructor. This will in turn invoke the call operator of the 2nd function passed to the constructor. Note: Similar call operators are present for all specified function types
- The authors originally developed and tested the library on:
+ The authors originally developed and tested this library on:
See the library regressions
test results for detailed information on supported compilers and
- platforms.
+ platforms. Check the library regression test
The maximum number of functions to overload is given by the
- Consider the following functions with distinct signatures:
+ Consider the following functions which have distinct signatures:
- [identity_decls]
+
This library header
- Note how function types in the following format are passed as template parameters
- to Description
+Description
Description
+Description
Description
+Description
function object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
. This is especially useful when the explicit type of the returned overloaded_function
does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
(or C++11 auto
) or when the overloaded function object is handled using a function template parameter, see the Tutorial section).
configuration macro.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
Description
+Description
F1
, F2
, etc. The specified function types must have distinct parameters from one another and they must be in the following format (which is the Boost.Function preferred syntax): result_type (argument1_type, argumgnet2_type, ...)
@@ -55,27 +55,27 @@
BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro.make_overloaded_function
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
, Boost.Function.
+
overloaded_function
public
construct/copy/destructoverloaded_function(const boost::function< F1 > &,
+
overloaded_function(const boost::function< F1 > &,
const boost::function< F2 > &, ...);
Construct the overloaded function object. boost::function
function object can be specified as parameter.
-
+overloaded_function
public member functions
+
overloaded_function
public member functions
boost::function_traits< F1 >::result_type
-operator()(typename boost::function_traits< F1 >::arg1_type,
+operator()(typename boost::function_traits< F1 >::arg1_type,
typename boost::function_traits< F1 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 1st template parameter. boost::function_traits< F2 >::result_type
-operator()(typename boost::function_traits< F2 >::arg1_type,
+operator()(typename boost::function_traits< F2 >::arg1_type,
typename boost::function_traits< F2 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 2nd template parameter. F1
, F2
, etc (even if not exhaustively listed by this documentation).
-
+
From c4824e0bd68dd4c22acd3ff4e7459fe8ccf7ef7c Mon Sep 17 00:00:00 2001
From: Lorenzo Caminiti Description
+Description
Description
+Description
Description
+Description
function object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
. This is especially useful when the explicit type of the returned overloaded_function
does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
(or C++11 auto
) or when the overloaded function object is handled using a function template parameter, see the Tutorial section).
configuration macro.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
Description
+Description
F1
, F2
, etc. The specified function types must have distinct parameters from one another and they must be in the following format (which is the Boost.Function preferred syntax): result_type (argument1_type, argumgnet2_type, ...)
@@ -55,27 +55,27 @@
BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro.make_overloaded_function
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
, Boost.Function.
+
overloaded_function
public
construct/copy/destructoverloaded_function(const boost::function< F1 > &,
+
overloaded_function(const boost::function< F1 > &,
const boost::function< F2 > &, ...);
Construct the overloaded function object. boost::function
function object can be specified as parameter.
-
+overloaded_function
public member functions
+
overloaded_function
public member functions
boost::function_traits< F1 >::result_type
-operator()(typename boost::function_traits< F1 >::arg1_type,
+operator()(typename boost::function_traits< F1 >::arg1_type,
typename boost::function_traits< F1 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 1st template parameter. boost::function_traits< F2 >::result_type
-operator()(typename boost::function_traits< F2 >::arg1_type,
+operator()(typename boost::function_traits< F2 >::arg1_type,
typename boost::function_traits< F2 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 2nd template parameter. F1
, F2
, etc (even if not exhaustively listed by this documentation). BOOST_AUTO(identity, boost::make_overloaded_function(
identity_s, identity_i, identity_d));
-BOOST_CHECK( identity("abc") == "abc" );
-BOOST_CHECK( identity(123) == 123 );
-BOOST_CHECK( identity(1.23) == 1.23 );
+BOOST_CHECK(identity("abc") == "abc");
+BOOST_CHECK(identity(123) == 123);
+BOOST_CHECK(identity(1.23) == 1.23);
template<typename F>
void check(F identity) {
- BOOST_CHECK( identity("abc") == "abc" );
- BOOST_CHECK( identity(123) == 123 );
- BOOST_CHECK( identity(1.23) == 1.23 );
+ BOOST_CHECK(identity("abc") == "abc");
+ BOOST_CHECK(identity(123) == 123);
+ BOOST_CHECK(identity(1.23) == 1.23);
}
BOOST_CHECK( identity_s("abc") == "abc" );
-BOOST_CHECK( identity_i(123) == 123 );
-BOOST_CHECK( identity_d(1.23) == 1.23 );
+
BOOST_CHECK(identity_s("abc") == "abc");
+BOOST_CHECK(identity_i(123) == 123);
+BOOST_CHECK(identity_d(1.23) == 1.23);
-
+
diff --git a/overloaded_function/test/identity.cpp b/overloaded_function/test/identity.cpp
index 7df5b7b..9028af7 100644
--- a/overloaded_function/test/identity.cpp
+++ b/overloaded_function/test/identity.cpp
@@ -14,9 +14,9 @@
//[identity_make_checks
templateDescription
+Description
Description
+Description
Description
+Description
function object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
. This is especially useful when the explicit type of the returned overloaded_function
does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
(or C++11 auto
) or when the overloaded function object is handled using a function template parameter, see the Tutorial section).
configuration macro.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
Description
+Description
F1
, F2
, etc. The specified function types must have distinct parameters from one another and they must be in the following format (which is the Boost.Function preferred syntax): result_type (argument1_type, argumgnet2_type, ...)
@@ -55,27 +55,27 @@
BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro.make_overloaded_function
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
, Boost.Function.
+
overloaded_function
public
construct/copy/destructoverloaded_function(const boost::function< F1 > &,
+
overloaded_function(const boost::function< F1 > &,
const boost::function< F2 > &, ...);
Construct the overloaded function object. boost::function
function object can be specified as parameter.
-
+overloaded_function
public member functions
+
overloaded_function
public member functions
boost::function_traits< F1 >::result_type
-operator()(typename boost::function_traits< F1 >::arg1_type,
+operator()(typename boost::function_traits< F1 >::arg1_type,
typename boost::function_traits< F1 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 1st template parameter. boost::function_traits< F2 >::result_type
-operator()(typename boost::function_traits< F2 >::arg1_type,
+operator()(typename boost::function_traits< F2 >::arg1_type,
typename boost::function_traits< F2 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 2nd template parameter. F1
, F2
, etc (even if not exhaustively listed by this documentation). -std=c++0x
) and MSVC 8.0 under Linux, Cygwin,
- and Windows 7.
+ The authors originally developed and tested the library on:
+
+
-std=c++0x
)
+ on Cygwin.
+ const std::string& identity_s(const std::string& x) { return x; } // As pointer.
-
-int identity_i_impl(int x) { return x; }
-int (&identity_i)(int) = identity_i_impl; // Function reference.
-
-double identity_d_impl(double x) { return x; }
-boost::function<double (double)> identity_d = identity_d_impl; // Functor.
-
-boost/functional/overloaded_function.hpp
provides a boost::overloaded_function
class template that creates a single overloaded function object that can
be used to call the specified functions instead of using the separate function
- names (see also identity.cpp
):
+ names (see also functor.cpp
+ and identity.hpp
):
boost::make_overloaded_function
function template can be useful when used together with Boost.Typeof's
- BOOST_AUTO
(or C++11 auto
). For example (see also identity.cpp
):
+ BOOST_AUTO
(or C++11 auto
). For example (see also make_decl.cpp
+ and identity.hpp
):
boost::make_overloaded_function
can be useful is when the overloaded function object is passed to a function
template which can hide the specific boost::overloaded_function
- type using a template parameter. For example (see also identity.cpp
):
+ type using a template parameter. For example (see also make_call.cpp
+ and identity.hpp
):
const std::string& identity_s(const std::string& x) { return x; } // As pointer.
-
-int identity_i_impl(int x) { return x; }
-int (&identity_i)(int) = identity_i_impl; // Function reference.
-
-double identity_d_impl(double x) { return x; }
-boost::function<double (double)> identity_d = identity_d_impl; // Functor.
-
-BOOST_CHECK
@@ -97,7 +88,8 @@
It is possible to use this library to create a single overloaded
function object (or functor)
named identity
that aggregates
- together the calls to the specific functions (see also identity.cpp
):
+ together the calls to the specific functions (see also functor.cpp
+ and identity.hpp
):
-
+
diff --git a/overloaded_function/doc/overloaded_function.qbk b/overloaded_function/doc/overloaded_function.qbk
index 0c1d589..8d2bf06 100644
--- a/overloaded_function/doc/overloaded_function.qbk
+++ b/overloaded_function/doc/overloaded_function.qbk
@@ -27,7 +27,9 @@
[def __Boost_Function__ [@http://www.boost.org/libs/function Boost.Function]]
[def __Boost_Typeof__ [@http://www.boost.org/doc/libs/typeof Boost.Typeof]]
-[import ../test/identity.cpp]
+[import ../test/functor.cpp]
+[import ../test/make_decl.cpp]
+[import ../test/make_call.cpp]
This library allows to overload different functions into a single function object.
@@ -45,9 +47,9 @@ The examples of this documentation are executed as part of the library test suit
[identity_calls]
-It is possible to use this library to create a single [@http://en.wikipedia.org/wiki/Function_overloading overloaded] function object (or [@http://en.wikipedia.org/wiki/Functor functor]) named `identity` that aggregates together the calls to the specific functions (see also [@../../test/identity.cpp =identity.cpp=]):
+It is possible to use this library to create a single [@http://en.wikipedia.org/wiki/Function_overloading overloaded] function object (or [@http://en.wikipedia.org/wiki/Functor functor]) named `identity` that aggregates together the calls to the specific functions (see also [@../../test/functor.cpp =functor.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
-[identity]
+[identity_functor]
Note how the functions are called via a single overloaded function object `identity` instead of using their different names `identity_s`, `identity_i`, and `identity_d`.
@@ -59,7 +61,12 @@ This section explains how to setup a system to use this library.
[section Compilers and Platforms]
-The library was tested by the authors on GCC 4.5.3 (with and without C++11 features [^-std=c++0x]) and MSVC 8.0 under Linux, Cygwin, and Windows 7.
+The authors originally developed and tested the library on:
+
+# GNU Compiler Collection (GCC) C++ 4.5.3 (with and without C++11 features enabled `-std=c++0x`) on Cygwin.
+# Miscrosoft Visual C++ (MSVC) 8.0 on Windows 7.
+
+See the library [@http://www.boost.org/development/tests/release/developer/functional-overloaded_function.html regressions test results] for detailed information on supported compilers and platforms.
[endsect]
@@ -87,9 +94,9 @@ Consider the following functions with distinct signatures:
[identity_decls]
-This library header [headerref boost/functional/overloaded_function.hpp] provides a [classref boost::overloaded_function] class template that creates a single overloaded function object that can be used to call the specified functions instead of using the separate function names (see also [@../../test/identity.cpp =identity.cpp=]):
+This library header [headerref boost/functional/overloaded_function.hpp] provides a [classref boost::overloaded_function] class template that creates a single overloaded function object that can be used to call the specified functions instead of using the separate function names (see also [@../../test/functor.cpp =functor.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
-[identity]
+[identity_functor]
Note how function types in the following format are passed as template parameters to [classref boost::overloaded_function] (this is the format of __Boost_Function__'s preferred syntax):
@@ -119,7 +126,7 @@ For convenience, this library also provides the [funcref boost::make_overloaded_
The function types are automatically deduced from the specified functions and the appropriate [classref boost::overloaded_function] instantiation is returned by [funcref boost::make_overloaded_function].
The [funcref boost::make_overloaded_function] function template can be useful when used together with __Boost_Typeof__'s `BOOST_AUTO` (or C++11 `auto`).
-For example (see also [@../../test/identity.cpp =identity.cpp=]):
+For example (see also [@../../test/make_decl.cpp =make_decl.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
[identity_make]
@@ -127,7 +134,7 @@ Note how the overloaded function object `identity` has been created specifying o
Therefore, [funcref boost::make_overloaded_function] provides a more concise syntax in this context when compared with [classref boost::overloaded_function].
Another case where [funcref boost::make_overloaded_function] can be useful is when the overloaded function object is passed to a function template which can hide the specific [classref boost::overloaded_function] type using a template parameter.
-For example (see also [@../../test/identity.cpp =identity.cpp=]):
+For example (see also [@../../test/make_call.cpp =make_call.cpp=] and [@../../test/identity.hpp =identity.hpp=]):
[identity_make_checks]
[identity_make_call]
diff --git a/overloaded_function/test/Jamfile.v2 b/overloaded_function/test/Jamfile.v2
index 8856aac..70d65f9 100644
--- a/overloaded_function/test/Jamfile.v2
+++ b/overloaded_function/test/Jamfile.v2
@@ -9,5 +9,7 @@ import testing ;
project : requirements Description
+Description
Description
+Description
Description
-
function object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
. This is especially useful when the explicit type of the returned overloaded_function
does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
(or C++11 auto
) or when the overloaded function object is handled using a function template parameter, see the Tutorial section).Description
+
object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
. This is especially useful when the explicit type of the returned overloaded_function
object does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
, C++11 auto
, or when the overloaded function object is handled using a function template parameter, see the Tutorial section).
configuration macro.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
__function_type__
is a placeholder for a symbol that is specific to implementation of this library.__function_type__
is a placeholder for a symbol that is specific to the implementation of this library.
, overloaded_function
. BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
Description
-F1
, F2
, etc. The specified function types must have distinct parameters from one another and they must be in the following format (which is the Boost.Function preferred syntax): result_type (argument1_type, argumgnet2_type, ...)
-
-make_overloaded_function
function template can be useful to construct the overloaded function object without explicitly specifying the function types.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro.Description
+F1
, F2
, etc which must have distinct function signatures from one another.
+
+
+
+Fi
Each function type must be specified using the following syntax (which is Boost.Function's preferred syntax):
+ result_type (argument1_type, argumgnet2_type, ...)
+
make_overloaded_function
function template can be useful to construct an overloaded function object without explicitly specifying the function types.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro.make_overloaded_function
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
, Boost.Function.
+
overloaded_function
public
construct/copy/destructoverloaded_function(const boost::function< F1 > &,
- const boost::function< F2 > &, ...);
Construct the overloaded function object. boost::function
function object can be specified as parameter. overloaded_function(const boost::function< F1 > &,
+ const boost::function< F2 > &, ...);
Construct the overloaded function object. boost::function
function object can be specified as parameter.
-
+overloaded_function
public member functions
+
overloaded_function
public member functions
boost::function_traits< F1 >::result_type
-operator()(typename boost::function_traits< F1 >::arg1_type,
+operator()(typename boost::function_traits< F1 >::arg1_type,
typename boost::function_traits< F1 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 1st template parameter. boost::function_traits< F2 >::result_type
-operator()(typename boost::function_traits< F2 >::arg1_type,
+operator()(typename boost::function_traits< F2 >::arg1_type,
typename boost::function_traits< F2 >::arg2_type, ...) const;
Call operator matching the signature of the function type specified as 2nd template parameter. F1
, F2
, etc (even if not exhaustively listed by this documentation).
Jamfile.v2
+ for any special configuration that might be required for a specific compiler.
BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
configuration macro. The maximum number of function parameters for each of
- the specified function types is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
+ the specified function type is given by the BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
configuration macro. All configuration macros have appropriate default values
- when they are left undefined by the user.
+ when they are left undefined.
const std::string& identity_s(const std::string& x) // Function (as pointer).
+ { return x; }
+
+int identity_i_impl(int x) { return x; }
+int (&identity_i)(int) = identity_i_impl; // Function reference.
+
+double identity_d_impl(double x) { return x; }
+boost::function<double (double)> identity_d = identity_d_impl; // Functor.
+
+boost/functional/overloaded_function.hpp
@@ -61,16 +71,15 @@
> identity(identity_s, identity_i, identity_d);
// All calls via single `identity` function.
-BOOST_CHECK(identity("abc") == "abc");
-BOOST_CHECK(identity(123) == 123);
-BOOST_CHECK(identity(1.23) == 1.23);
+BOOST_TEST(identity("abc") == "abc");
+BOOST_TEST(identity(123) == 123);
+BOOST_TEST(identity(1.23) == 1.23);
boost::overloaded_function
- (this is the format of Boost.Function's
+ Note how each function type is passed as a template parameter of boost::overloaded_function
using
+ the following syntax (this is Boost.Function's
preferred syntax):
result-type (argument1-type, argument2-type, ...)
@@ -79,10 +88,10 @@
Then the relative function pointers, function references, or monomorphic
function objects are passed to the
boost::overloaded_function
constructor matching the order of the specified template parameters. [2] In the above example, identity_s
- is passed as function pointer (the function address is automatically taken
- from the function name by compiler), identity_i
- as function reference, and identity_d
- as function object.
+ is passed as a function pointer (the function address is automatically taken
+ from the function name by the compiler), identity_i
+ as a function reference, and identity_d
+ as a function object.
All specified function types must have distinct parameters from one another @@ -114,9 +123,9 @@
BOOST_AUTO(identity, boost::make_overloaded_function( identity_s, identity_i, identity_d)); -BOOST_CHECK(identity("abc") == "abc"); -BOOST_CHECK(identity(123) == 123); -BOOST_CHECK(identity(1.23) == 1.23); +BOOST_TEST(identity("abc") == "abc"); +BOOST_TEST(identity(123) == 123); +BOOST_TEST(identity(1.23) == 1.23);
@@ -135,7 +144,7 @@
Another case where boost::make_overloaded_function
can be useful is when the overloaded function object is passed to a function
- template which can hide the specific boost::overloaded_function
+ template which can hold the specific boost::overloaded_function
type using a template parameter. For example (see also make_call.cpp
and identity.hpp
):
template<typename F> void check(F identity) { - BOOST_CHECK(identity("abc") == "abc"); - BOOST_CHECK(identity(123) == 123); - BOOST_CHECK(identity(1.23) == 1.23); + BOOST_TEST(identity("abc") == "abc"); + BOOST_TEST(identity(123) == 123); + BOOST_TEST(identity(1.23) == 1.23); }
@@ -154,6 +163,27 @@
check(boost::make_overloaded_function(identity_s, identity_i, identity_d));+
+
+
+ The library implementation of boost::make_overloaded_function
+ uses Boost.Typeof
+ to automatically deduce some of the function types. In order to compile code
+ in Boost.Typeof
+ emulation mode, all types should be properly registered using BOOST_TYPEOF_REGISTER_TYPE
and BOOST_TYPEOF_REGISTER_TEMPLATE
, or appropriate
+ Boost.Typeof headers
+ should be included (see Boost.Typeof
+ for more information). For the above examples, it is sufficient to include
+ the Boost.Typeof
+ header that registers std::string
+ (this library does not require to register boost::function
+ for Boost.Typeof
+ emulation):
+
+
+#include <boost/typeof/std/string.hpp> // No need to register `boost::function`. +
@@ -171,6 +201,8 @@ pointers and function references). Finally, monomorphic function objects are instances of classes with a non-template call operator of the form
result-type
operator()(
argument1-type
, ...)
.
+ Unfortunately, it is not possible to support polymorphic function objects
+ (see http://lists.boost.org/Archives/boost/2012/03/191744.php).
[3] Note that in C++ the function result type is not used for overload resolution diff --git a/overloaded_function/doc/html/index.html b/overloaded_function/doc/html/index.html index 1ca359c..c5ac2b1 100644 --- a/overloaded_function/doc/html/index.html +++ b/overloaded_function/doc/html/index.html @@ -66,21 +66,31 @@ Introduction
- Consider the following functions with distinct signatures: + Consider the following functions which have distinct signatures:
- [identity_decls] +
+const std::string& identity_s(const std::string& x) // Function (as pointer). + { return x; } + +int identity_i_impl(int x) { return x; } +int (&identity_i)(int) = identity_i_impl; // Function reference. + +double identity_d_impl(double x) { return x; } +boost::function<double (double)> identity_d = identity_d_impl; // Functor. ++
- Instead of calling them using their separate names (here BOOST_CHECK
+ Instead of calling them using their separate names (here BOOST_TEST
is equivalent to assert
):
[1]
-
BOOST_CHECK(identity_s("abc") == "abc"); -BOOST_CHECK(identity_i(123) == 123); -BOOST_CHECK(identity_d(1.23) == 1.23); +BOOST_TEST(identity_s("abc") == "abc"); +BOOST_TEST(identity_i(123) == 123); +BOOST_TEST(identity_d(1.23) == 1.23);@@ -100,9 +110,9 @@ > identity(identity_s, identity_i, identity_d); // All calls via single `identity` function. -BOOST_CHECK(identity("abc") == "abc"); -BOOST_CHECK(identity(123) == 123); -BOOST_CHECK(identity(1.23) == 1.23); +BOOST_TEST(identity("abc") == "abc"); +BOOST_TEST(identity(123) == 123); +BOOST_TEST(identity(1.23) == 1.23);
@@ -116,16 +126,19 @@
[1]
- In the examples presented in this documentation, BOOST_CHECK
- is used instead of assert
- because it allows to write regression tests using Boost.Test.
- The examples of this documentation are executed as part of the library test
- suite to verify that they always compile and run correctly.
+ In most of the examples presented in this documentation, the Boost.Detail/LightweightTest
+ (boost/detail/lightweight_test.hpp
) macro BOOST_TEST
is used to check correctness
+ conditions (conceptually similar to assert
).
+ A failure of the checked condition does not abort the execution of the program,
+ it will instead make boost::report_errors
+ return a non-zero program exit code. Using Boost.Detail/LightweightTest allows
+ to add the examples to the library regression tests so to make sure that
+ they always compile and run correctly.
Last revised: March 22, 2012 at 20:51:03 GMT |
+Last revised: April 10, 2012 at 20:37:20 GMT |
Overload distinct function pointers, function references, and function objects into a single function object.
+Overload distinct function pointers, function references, and monomorphic function objects into a single function object.
namespace boost { template<typename F1, typename F2, ... > class overloaded_function; template<typename F1, typename F2, ... > diff --git a/overloaded_function/doc/overloaded_function.qbk b/overloaded_function/doc/overloaded_function.qbk index 8d2bf06..5bda0df 100644 --- a/overloaded_function/doc/overloaded_function.qbk +++ b/overloaded_function/doc/overloaded_function.qbk @@ -27,6 +27,7 @@ [def __Boost_Function__ [@http://www.boost.org/libs/function Boost.Function]] [def __Boost_Typeof__ [@http://www.boost.org/doc/libs/typeof Boost.Typeof]] +[import ../test/identity.hpp] [import ../test/functor.cpp] [import ../test/make_decl.cpp] [import ../test/make_call.cpp] @@ -35,14 +36,15 @@ This library allows to overload different functions into a single function objec [section:Introduction Introduction] -Consider the following functions with distinct signatures: +Consider the following functions which have distinct signatures: [identity_decls] -Instead of calling them using their separate names (here `BOOST_CHECK` is equivalent to `assert`): +Instead of calling them using their separate names (here `BOOST_TEST` is equivalent to `assert`): [footnote -In the examples presented in this documentation, `BOOST_CHECK` is used instead of `assert` because it allows to write regression tests using __Boost_Test__. -The examples of this documentation are executed as part of the library test suite to verify that they always compile and run correctly. +In most of the examples presented in this documentation, the Boost.Detail/LightweightTest (=boost/detail/lightweight_test.hpp=) macro `BOOST_TEST` is used to check correctness conditions (conceptually similar to `assert`). +A failure of the checked condition does not abort the execution of the program, it will instead make `boost::report_errors` return a non-zero program exit code. +Using Boost.Detail/LightweightTest allows to add the examples to the library regression tests so to make sure that they always compile and run correctly. ] [identity_calls] @@ -61,12 +63,13 @@ This section explains how to setup a system to use this library. [section Compilers and Platforms] -The authors originally developed and tested the library on: +The authors originally developed and tested this library on: # GNU Compiler Collection (GCC) C++ 4.5.3 (with and without C++11 features enabled `-std=c++0x`) on Cygwin. # Miscrosoft Visual C++ (MSVC) 8.0 on Windows 7. See the library [@http://www.boost.org/development/tests/release/developer/functional-overloaded_function.html regressions test results] for detailed information on supported compilers and platforms. +Check the library regression test [@../../test/Jamfile.v2 =Jamfile.v2=] for any special configuration that might be required for a specific compiler. [endsect] @@ -77,8 +80,8 @@ Therefore there is no pre-compiled object file which needs to be installed. Programmers can simply instruct the compiler where to find the library header files (`-I` option on GCC, `/I` option on MSVC, etc) and compile code using the library. The maximum number of functions to overload is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX] configuration macro. -The maximum number of function parameters for each of the specified function types is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX] configuration macro. -All configuration macros have appropriate default values when they are left undefined by the user. +The maximum number of function parameters for each of the specified function type is given by the [macroref BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX] configuration macro. +All configuration macros have appropriate default values when they are left undefined. [endsect] @@ -90,7 +93,7 @@ This section explains how to use this library. [section Overloading] -Consider the following functions with distinct signatures: +Consider the following functions which have distinct signatures: [identity_decls] @@ -98,7 +101,7 @@ This library header [headerref boost/functional/overloaded_function.hpp] provide [identity_functor] -Note how function types in the following format are passed as template parameters to [classref boost::overloaded_function] (this is the format of __Boost_Function__'s preferred syntax): +Note how each function type is passed as a template parameter of [classref boost::overloaded_function] using the following syntax (this is __Boost_Function__'s preferred syntax): ``/result-type/`` (``/argument1-type/``, ``/argument2-type/``, ...) @@ -108,8 +111,9 @@ Function pointers are of the form [^['result-type ]]`(*)(`[^['argument1-type]]`, Function references are of the form [^['result-type ]]`(&)(`[^['argument1-type]]`, ...)`. Function types are of the form [^['result-type ]]`(`[^['argument1-type]]`, ...)` (note how they lack of both `*` and `&` when compared to function pointers and function references). Finally, monomorphic function objects are instances of classes with a non-template call operator of the form [^['result-type ]]`operator()(`[^['argument1-type]]`, ...)`. +Unfortunately, it is not possible to support polymorphic function objects (see [@http://lists.boost.org/Archives/boost/2012/03/191744.php]). ] -In the above example, `identity_s` is passed as function pointer (the function address is automatically taken from the function name by compiler), `identity_i` as function reference, and `identity_d` as function object. +In the above example, `identity_s` is passed as a function pointer (the function address is automatically taken from the function name by the compiler), `identity_i` as a function reference, and `identity_d` as a function object. All specified function types must have distinct parameters from one another (so the overloaded calls can be resolved by this library). [footnote @@ -128,17 +132,23 @@ The function types are automatically deduced from the specified functions and th The [funcref boost::make_overloaded_function] function template can be useful when used together with __Boost_Typeof__'s `BOOST_AUTO` (or C++11 `auto`). For example (see also [@../../test/make_decl.cpp =make_decl.cpp=] and [@../../test/identity.hpp =identity.hpp=]): -[identity_make] +[identity_make_decl] Note how the overloaded function object `identity` has been created specifying only the functions `identity_s`, `identity_i`, `identity_d` and without specifying the function types `const std::string& (const std::string&)`, `int (int)`, and `double (double)` as required instead by [classref boost::overloaded_function]. Therefore, [funcref boost::make_overloaded_function] provides a more concise syntax in this context when compared with [classref boost::overloaded_function]. -Another case where [funcref boost::make_overloaded_function] can be useful is when the overloaded function object is passed to a function template which can hide the specific [classref boost::overloaded_function] type using a template parameter. +Another case where [funcref boost::make_overloaded_function] can be useful is when the overloaded function object is passed to a function template which can hold the specific [classref boost::overloaded_function] type using a template parameter. For example (see also [@../../test/make_call.cpp =make_call.cpp=] and [@../../test/identity.hpp =identity.hpp=]): [identity_make_checks] [identity_make_call] +The library implementation of [funcref boost::make_overloaded_function] uses __Boost_Typeof__ to automatically deduce some of the function types. +In order to compile code in __Boost_Typeof__ emulation mode, all types should be properly registered using `BOOST_TYPEOF_REGISTER_TYPE` and `BOOST_TYPEOF_REGISTER_TEMPLATE`, or appropriate __Boost_Typeof__ headers should be included (see __Boost_Typeof__ for more information). +For the above examples, it is sufficient to include the __Boost_Typeof__ header that registers `std::string` (this library does not require to register `boost::function` for __Boost_Typeof__ emulation): + +[identity_typeof] + [endsect] [endsect] diff --git a/overloaded_function/test/identity.hpp b/overloaded_function/test/identity.hpp index 6602152..755a6da 100644 --- a/overloaded_function/test/identity.hpp +++ b/overloaded_function/test/identity.hpp @@ -9,10 +9,14 @@ #define IDENTITY_HPP_ #include+//[identity_typeof +#include // No need to register `boost::function`. +//] #include //[identity_decls -const std::string& identity_s(const std::string& x) { return x; } // As pointer. +const std::string& identity_s(const std::string& x) // Function (as pointer). + { return x; } int identity_i_impl(int x) { return x; } int (&identity_i)(int) = identity_i_impl; // Function reference. diff --git a/overloaded_function/test/make_decl.cpp b/overloaded_function/test/make_decl.cpp index 7aae187..6f5cbdf 100644 --- a/overloaded_function/test/make_decl.cpp +++ b/overloaded_function/test/make_decl.cpp @@ -7,12 +7,11 @@ #include "identity.hpp" #include -#include // For `BOOST_AUTO`. -#include // No need to register `boost::function`. +#include #include int main() { - //[identity_make + //[identity_make_decl BOOST_AUTO(identity, boost::make_overloaded_function( identity_s, identity_i, identity_d)); From c5a4dc3db111ec2245bc5fcf166992380cc4d030 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Tue, 10 Apr 2012 21:09:36 +0000 Subject: [PATCH 14/51] Commented out some code in overloaded_function to try to see what breaks on Sun. [SVN r77900] --- include/boost/functional/overloaded_function.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/functional/overloaded_function.hpp b/include/boost/functional/overloaded_function.hpp index 2ed228d..9e24e99 100644 --- a/include/boost/functional/overloaded_function.hpp +++ b/include/boost/functional/overloaded_function.hpp @@ -11,8 +11,9 @@ # ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ -# include -# include +/** @todo[Lorenzo Caminiti] Uncomment this... trying to see what breaks on Sun */ +//# include +//# include # include # include # include From 094516d6869f272faa985d0387d49938a8a7d2b3 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Wed, 11 Apr 2012 20:55:54 +0000 Subject: [PATCH 15/51] Added some tests to figure out pp problem with OverloadedFunciton on Sun. [SVN r77925] --- include/boost/functional/overloaded_function.hpp | 5 ++--- include/boost/functional/overloaded_function/detail/base.hpp | 4 +++- .../functional/overloaded_function/detail/function_type.hpp | 2 +- overloaded_function/test/identity.hpp | 2 +- overloaded_function/test/sun_bug.cpp | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/boost/functional/overloaded_function.hpp b/include/boost/functional/overloaded_function.hpp index 9e24e99..2ed228d 100644 --- a/include/boost/functional/overloaded_function.hpp +++ b/include/boost/functional/overloaded_function.hpp @@ -11,9 +11,8 @@ # ifndef BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_HPP_ -/** @todo[Lorenzo Caminiti] Uncomment this... trying to see what breaks on Sun */ -//# include -//# include +# include +# include # include # include # include diff --git a/include/boost/functional/overloaded_function/detail/base.hpp b/include/boost/functional/overloaded_function/detail/base.hpp index 8fd9a0a..38083ed 100644 --- a/include/boost/functional/overloaded_function/detail/base.hpp +++ b/include/boost/functional/overloaded_function/detail/base.hpp @@ -10,7 +10,7 @@ # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ # include -# include +/**@todo# include */ # include # include # include @@ -39,10 +39,12 @@ namespace boost { namespace overloaded_function_detail { template class base {}; // Empty template cannot be used directly (only its spec). +/*@todo # define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \ "boost/functional/overloaded_function/detail/base.hpp")) # include BOOST_PP_ITERATE() // Iterate over funciton arity. +*/ } } // namespace diff --git a/include/boost/functional/overloaded_function/detail/function_type.hpp b/include/boost/functional/overloaded_function/detail/function_type.hpp index 0c28607..58bf09c 100644 --- a/include/boost/functional/overloaded_function/detail/function_type.hpp +++ b/include/boost/functional/overloaded_function/detail/function_type.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +/** @todo #include */ #include #include #include diff --git a/overloaded_function/test/identity.hpp b/overloaded_function/test/identity.hpp index 755a6da..9b64da7 100644 --- a/overloaded_function/test/identity.hpp +++ b/overloaded_function/test/identity.hpp @@ -8,7 +8,7 @@ #ifndef IDENTITY_HPP_ #define IDENTITY_HPP_ -#include +/** @todo #include */ //[identity_typeof #include // No need to register `boost::function`. //] diff --git a/overloaded_function/test/sun_bug.cpp b/overloaded_function/test/sun_bug.cpp index 024d4b3..ac829b2 100644 --- a/overloaded_function/test/sun_bug.cpp +++ b/overloaded_function/test/sun_bug.cpp @@ -1,5 +1,6 @@ -#include +/**@todo remove this test */ +#include int main() { return 0; } From 90b94a956043d8f82b626eb58ced3654a9e2bb37 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Thu, 12 Apr 2012 21:12:28 +0000 Subject: [PATCH 16/51] Forcing type-of emulation on Sun. Trying to fix OverloadedFunction pp bug on Sun by removing SUB on iteration range (doing ADD on iteration index instead). [SVN r77940] --- .../boost/functional/overloaded_function.hpp | 17 ++++++++--------- .../overloaded_function/detail/base.hpp | 4 +--- .../detail/function_type.hpp | 2 +- overloaded_function/test/Jamfile.v2 | 3 +++ overloaded_function/test/identity.hpp | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/boost/functional/overloaded_function.hpp b/include/boost/functional/overloaded_function.hpp index 2ed228d..f224c4f 100644 --- a/include/boost/functional/overloaded_function.hpp +++ b/include/boost/functional/overloaded_function.hpp @@ -24,6 +24,7 @@ # include # include # include +# include # include # include # include @@ -82,14 +83,10 @@ BOOST_FUNCTIONAL_f_type(z, n, ~) \ >::type -// Iterate within namespace. -# define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_OVERLOAD_COUNT \ - /*at least 2 func to overload 2, 3, ...*/ \ - BOOST_PP_SUB( \ - BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - 2) # define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_OVERLOAD_COUNT, \ + /* at least 2 func to overload so start from 2 to MAX */ \ + /* (cannot iterate [0, MAX-2) because error on Sun) */ \ + (3, (2, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ "boost/functional/overloaded_function.hpp")) # include BOOST_PP_ITERATE() // Iterate over function arity. @@ -113,8 +110,10 @@ #elif BOOST_PP_ITERATION_DEPTH() == 1 # define BOOST_FUNCTIONAL_overloads \ /* iterate as OVERLOADS, OVERLOADS-1, OVERLOADS-2, ... */ \ - BOOST_PP_SUB(BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ - BOOST_PP_FRAME_ITERATION(1)) + /* (add 2 because iteration started from 2 to MAX) */ \ + BOOST_PP_ADD(2, BOOST_PP_SUB( \ + BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX, \ + BOOST_PP_FRAME_ITERATION(1))) # define BOOST_FUNCTIONAL_is_tspec \ /* if template specialization */ \ BOOST_PP_LESS(BOOST_FUNCTIONAL_overloads, \ diff --git a/include/boost/functional/overloaded_function/detail/base.hpp b/include/boost/functional/overloaded_function/detail/base.hpp index 38083ed..8fd9a0a 100644 --- a/include/boost/functional/overloaded_function/detail/base.hpp +++ b/include/boost/functional/overloaded_function/detail/base.hpp @@ -10,7 +10,7 @@ # define BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_DETAIL_BASE_HPP_ # include -/**@todo# include */ +# include # include # include # include @@ -39,12 +39,10 @@ namespace boost { namespace overloaded_function_detail { template class base {}; // Empty template cannot be used directly (only its spec). -/*@todo # define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX, \ "boost/functional/overloaded_function/detail/base.hpp")) # include BOOST_PP_ITERATE() // Iterate over funciton arity. -*/ } } // namespace diff --git a/include/boost/functional/overloaded_function/detail/function_type.hpp b/include/boost/functional/overloaded_function/detail/function_type.hpp index 58bf09c..0c28607 100644 --- a/include/boost/functional/overloaded_function/detail/function_type.hpp +++ b/include/boost/functional/overloaded_function/detail/function_type.hpp @@ -16,7 +16,7 @@ #include #include #include -/** @todo #include */ +#include #include #include #include diff --git a/overloaded_function/test/Jamfile.v2 b/overloaded_function/test/Jamfile.v2 index 160130d..f4fab4c 100644 --- a/overloaded_function/test/Jamfile.v2 +++ b/overloaded_function/test/Jamfile.v2 @@ -7,6 +7,9 @@ import testing ; +# Sun does not automatically detect type-of emulation (force it). +project : requirements sun: BOOST_TYPEOF_EMULATION ; + run functor.cpp ; run make_decl.cpp ; run make_call.cpp ; diff --git a/overloaded_function/test/identity.hpp b/overloaded_function/test/identity.hpp index 9b64da7..5134429 100644 --- a/overloaded_function/test/identity.hpp +++ b/overloaded_function/test/identity.hpp @@ -8,10 +8,10 @@ #ifndef IDENTITY_HPP_ #define IDENTITY_HPP_ -/** @todo #include */ //[identity_typeof #include // No need to register `boost::function`. //] +#include #include //[identity_decls From 6360c143f1365794026dd2272862fa6208a12f69 Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Fri, 13 Apr 2012 01:02:02 +0000 Subject: [PATCH 17/51] Added Lorenzo Caminiti to maintainers.txt and libraries.htm. [SVN r77945] --- ..._OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html | 2 +- ...ERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX.html | 2 +- .../html/boost/make_overloaded_function.html | 2 +- .../doc/html/boost/overloaded_function.html | 22 +++++++++---------- overloaded_function/doc/html/index.html | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html b/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html index 9e12102..b59ac5a 100644 --- a/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html +++ b/overloaded_function/doc/html/BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX.html @@ -33,7 +33,7 @@ BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_ARITY_MAX
If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When specified by the user, this macro must be a non-negative integer number.
If this macro is left undefined by the user, it has a default value of 5 (increasing this number might increase compilation time). When defined by the user, this macro must be an integer number greater or equal than 2 (because at least two distinct functions need to be specified in order to define an overload).
This function template creates and returns an
object that overloads all the specified functions overloaded_function
f1
, f2
, etc.
The function types are internally determined from the template parameter types so they do not need to be explicitly specified. Therefore, this function template usually has a more concise syntax when compared with
. This is especially useful when the explicit type of the returned overloaded_function
object does not need to be known (e.g., when used with Boost.Typeof's overloaded_function
BOOST_AUTO
, C++11 auto
, or when the overloaded function object is handled using a function template parameter, see the Tutorial section).
The maximum number of functions to overload is given by the
configuration macro.BOOST_FUNCTIONAL_OVERLOADED_FUNCTION_CONFIG_OVERLOAD_MAX
This function object aggregates together calls to functions of all the specified function types F1
, F2
, etc which must have distinct function signatures from one another.
Parameters: