From 0071f7439336a03006fb8a14dddd3a00c67ef713 Mon Sep 17 00:00:00 2001
From: Daniel James
Boost.FunctionTypes uses tag types to encode properties that are not types
per se, such as calling convention or whether a function is variadic or cv-
@@ -84,7 +85,11 @@
Thanks go to the following people for supporting the development of this library
in one or the other way:
@@ -78,7 +79,11 @@
Boost.FunctionTypes provides functionality to classify, decompose and synthesize
function, function pointer, function reference and pointer to member types.
@@ -56,35 +57,34 @@
constant called
Templates that encapsulate properties that are single types contain a type
member called
Templates that encapsulate properties that are type lists model an MPL-compatible
type sequence.
The library does not define the required members of class templates in case
of an error. This technique causes the compiler to stop displaying diagnostics
@@ -40,10 +41,10 @@
The library's components have limited error conditions, so problematic input
can be spotted easily.
MPL provides algorithms on Sequences, so transformations (such as turning by-value
parameter types into const references for optimized forwarding or computing
@@ -53,20 +54,20 @@
other Boost libraries (most importantly Fusion),
so another reason is interoperability.
Despite their syntax, pointer to member object types can be seen as dereferencing
functionals.
Let's consider the alternatives.
-Home
+Home
Libraries
-People
-FAQ
+People
+FAQ
More
@@ -24,7 +24,8 @@
- Copyright © 2004 -2007 Tobias Schwinger
+
-Home
+Home
Libraries
-People
-FAQ
+People
+FAQ
More
@@ -23,7 +23,8 @@
- Copyright © 2004 -2007 Tobias Schwinger
+
-Home
+Home
Libraries
-People
-FAQ
+People
+FAQ
More
@@ -24,7 +24,8 @@
value
.
-is_function_pointer< bool(*)(int) >::value // == true
+is_function_pointer< bool(*)(int) >::value // == true
-function_arity< bool(*)(int) >::value // == 1
+function_arity< bool(*)(int) >::value // == 1
type
.
-function_type< mpl::vector<bool,int> >::type // is bool(int)
+function_type< mpl::vector<bool,int> >::type // is bool(int)
-result_type< bool(&)(int) >::type // is bool
+result_type< bool(&)(int) >::type // is bool
-parameter_types< bool(int) > // models an MPL sequence
+parameter_types< bool(int) > // models an MPL sequence
- Copyright © 2004 -2007 Tobias Schwinger
+
-Home
+Home
Libraries
-People
-FAQ
+People
+FAQ
More
@@ -24,12 +24,13 @@
+
+ Error
handling rationale
-
+
-
- Why MPL Sequences?
-
+
+
+ Why MPL Sequences?
+
-
- Pointer
+
+
+
+ Pointer
to member object types
-
-
- The
+
+
+
+ The
ClassTransform template parameter
-
This
-pointer, this
-reference or just
the object (or maybe even a smart pointer to the object) plus adjustments of
@@ -79,10 +80,10 @@
client to adjust the class type before the sequence is formed and then treat
all parameters uniformly.
-
- Why tag types?
-
+
+
+ Why tag types?
+
Yes, but it isn't immediately obvious as the set of possible MPL sequences isn't inherently disjoint from the set of callable builtin types. @@ -113,25 +114,23 @@ idea, because builtin types are accessible before the headers that make the type a sequence have been included, which can easily violate the ODR.
-this
parameter count for the function arity
of member functions?
- It was found preferable that the following condition holds:
-mpl::size< parameter_types<T> >::value == function_arity<T>::value +mpl::size< parameter_types<T> >::value == function_arity<T>::value-
A cv-qualified pointer is still a pointer. It usually doesn't matter and even if it does, it's a job for Boost.TypeTraits. @@ -139,7 +138,11 @@
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_function;
@@ -93,12 +90,11 @@
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_function_pointer;
@@ -137,12 +133,11 @@
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_function_reference;
@@ -181,12 +176,11 @@
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_member_pointer;
@@ -225,9 +219,9 @@
template<typename T> struct is_member_object_pointer; @@ -263,12 +257,11 @@-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_member_function_pointer;@@ -307,12 +300,11 @@
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_callable_builtin;@@ -351,12 +343,11 @@
-template<typename T, typename Tag = null_tag> +template<typename T, typename Tag = null_tag> struct is_nonmember_callable_builtin;@@ -397,7 +388,11 @@
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
template<typename F> struct result_type; @@ -78,9 +75,9 @@template<typename F, class ClassTransform = add_reference<_> > struct parameter_types; @@ -124,9 +121,9 @@template<typename F> struct function_arity; @@ -169,9 +166,9 @@template<typename T, class ClassTransform = add_reference<_> > struct components; @@ -216,14 +213,17 @@If
T
is no callable builtin type, the component types - are an empty sequence and the Tag's meaning is equivalent to thenull_tag
. + are an empty sequence and the Tag's meaning is equivalent to thenull_tag
.
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
Expands to a numeric value that describes the maximum function arity supported by the library. @@ -66,17 +67,16 @@
Expands to a sequence
of ternary tuples
(these data types are defined in the documentation
of the Boost Preprocessor library). Each sequence element describes
one calling convention specifier. The first element in each tuple is the
- macro suffix for BOOST_FT_CC_*
,
+ macro suffix for BOOST_FT_CC_*
,
the second element is the name of the tag that describes the calling convention
and the third is the name of the specifier. The specifier is allowed to
be an empty string, so the third tuple element is either BOOST_PP_EMPTY
@@ -106,15 +106,13 @@
- Enables a specific calling convention. * dentoes the macro suffix, as defined
- by BOOST_FT_CC_NAMES
- or BOOST_FT_BUILTIN_CC_NAMES
.
+ Enables a specific calling convention. * denotes the macro suffix, as defined
+ by BOOST_FT_CC_NAMES
+ or BOOST_FT_BUILTIN_CC_NAMES
.
The macro expands to a list of restrictions, separated by the |
@@ -149,9 +147,9 @@
Defining this macro causes the following macros to be defined, if not defined already: @@ -164,9 +162,9 @@
This macro allows to change the syntax of callable builtin types. It is useful to handle the compiler specific placement of the calling convention @@ -182,9 +180,9 @@
Set to void
for compilers that insist on a void
parameter for nullary function types, empty by default.
@@ -192,9 +190,9 @@
Disables support for cv-qualified function types. Cv-qualified function types are illegal by the current standard version, but there is a pending @@ -209,9 +207,9 @@
Makes the compiler preprocess as much as possible of the library code (rather than loading already-preprocessed header files) if defined. @@ -219,24 +217,27 @@
Makes the compiler preprocess the loop over possible names for custom calling conventions (rather than loading an already-preprocessed header file) if defined.
- This macro is defined automatically if BOOST_FT_CC_NAMES
+ This macro is defined automatically if BOOST_FT_CC_NAMES
has been defined.
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
-template<typename Types, typename Tag = null_tag> +template<typename Types, typename Tag = null_tag> struct function_type;
@@ -84,12 +81,11 @@
-template<typename Types, typename Tag = null_tag> +template<typename Types, typename Tag = null_tag> struct function_pointer;
@@ -127,12 +123,11 @@
-template<typename Types, typename Tag = null_tag> +template<typename Types, typename Tag = null_tag> struct function_reference;
@@ -170,12 +165,11 @@
-template<typename Types, typename Tag = null_tag> +template<typename Types, typename Tag = null_tag> struct member_function_pointer;
@@ -220,7 +214,11 @@
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
typedef unspecified variadic;@@ -73,9 +73,9 @@
typedef unspecified non_variadic;@@ -91,9 +91,9 @@
typedef unspecified default_cc;@@ -109,9 +109,9 @@
typedef unspecified const_qualified;@@ -127,9 +127,9 @@
typedef unspecified non_const;@@ -145,9 +145,9 @@
typedef unspecified volatile_qualified;@@ -163,9 +163,9 @@
typedef unspecified non_volatile;@@ -181,7 +181,8 @@
typedef unspecified non_cv;@@ -199,9 +200,9 @@
typedef unspecified const_non_volatile;@@ -219,9 +220,9 @@
typedef unspecified volatile_non_const;@@ -239,9 +240,9 @@
typedef unspecified cv_qualified;@@ -259,9 +260,9 @@
typedef unspecified null_tag;@@ -277,7 +278,8 @@
template<class Tag1, class Tag2, class Tag3 = null_tag, class Tag4 = null_tag> @@ -310,7 +312,11 @@
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
Generic libraries that accept callable arguments are common in C++. Accepting a callable argument of builin type often involves a lot of repetitive code @@ -143,8 +144,7 @@ arguments from a type sequence in a single expression:
-static_cast<function_pointer<Seq>::type>(& overloaded) +static_cast<function_pointer<Seq>::type>(& overloaded)
This technique can be occasionally more flexible than template argument deduction @@ -165,7 +165,11 @@
- | Copyright © 2004 -2007 Tobias Schwinger | +
![]() |
-Home | +Home | Libraries | -People | -FAQ | +People | +FAQ | More |
Copyright © 2004 -2007 Tobias Schwinger
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -46,8 +46,8 @@Last revised: November 05, 2007 at 18:24:58 +0100 |
-+ | Last revised: March 14, 2008 at 18:36:46 +0000 |
+