diff --git a/doc/apa.html b/doc/apa.html index ef4ab5c..44b5811 100644 --- a/doc/apa.html +++ b/doc/apa.html @@ -5,7 +5,7 @@ The Boost Lambda Library">
The highest placeholder index in a lambda expression determines the arity of the resulting function object. diff --git a/doc/ar01s02.html b/doc/ar01s02.html index ad318da..3a36b91 100644 --- a/doc/ar01s02.html +++ b/doc/ar01s02.html @@ -8,7 +8,7 @@ The Boost Lambda Library">
+ The Boost Lambda Library">
The library consists of include files only, hence there is no installation procedure. The boost include directory must be on the include path. @@ -44,7 +44,7 @@ Cast expressions Tuple [tuple] and the type_traits [type_traits] libraries, and on the boost/ref.hpp header.
All definitions are placed in the namespace boost::lambda and its subnamespaces. -
In most code examples, we omit the namespace prefixes for names in the std and boost::lambda namespaces. +
In most code examples, we omit the namespace prefixes for names in the std and boost::lambda namespaces. Implicit using declarations
using namespace std;
diff --git a/doc/ar01s03.html b/doc/ar01s03.html
index b7dd15f..cc18b38 100644
--- a/doc/ar01s03.html
+++ b/doc/ar01s03.html
@@ -5,7 +5,7 @@
The Boost Lambda Library">The Standard Template Library (STL)
+ The Boost Lambda Library">
The Standard Template Library (STL)
[STL94], now part of the C++ Standard Library [C++98], is a generic container and algorithm library.
Typically STL algorithms operate on container elements via function objects. These function objects are passed as arguments to the algorithms.
@@ -105,7 +105,7 @@ as function composition is supported implicitly.
-
Lambda expression are common in functional programming languages.
Their syntax varies between languages (and between different forms of lambda calculus), but the basic form of a lambda expressions is:
diff --git a/doc/ar01s04.html b/doc/ar01s04.html
index 510738a..f055718 100644
--- a/doc/ar01s04.html
+++ b/doc/ar01s04.html
@@ -20,7 +20,7 @@ There are quite a lot of exceptions and special cases, but discussion of them is
list<int> v(10);
for_each(v.begin(), v.end(), _1 = 1);
- The expression _1 = 1 creates a lambda functor which assigns the value 1 to every element in v.[1]
+ The expression _1 = 1 creates a lambda functor which assigns the value 1 to every element in v.[1]
Next, we create a container of pointers and make them point to the elements in the first container v:
@@ -206,7 +206,7 @@ This is to prevent pointer arithmetic making non-const arrays const.
-
[1]
+
[1]
Strictly taken, the C++ standard defines for_each as a non-modifying sequence operation, and the function object passed to for_each should not modify its argument.
The requirements for the arguments of for_each are unnecessary strict, since as long as the iterators are mutable, for_each accepts a function object that can have side-effects on their argument.
Nevertheless, it is straightforward to provide another function template with the functionality ofstd::for_each but more fine-grained requirements for its arguments.
diff --git a/doc/ar01s05.html b/doc/ar01s05.html
index 54b1900..027267a 100644
--- a/doc/ar01s05.html
+++ b/doc/ar01s05.html
@@ -10,7 +10,6 @@ This section describes different categories of lambda expressions in details.
We devote a separate section for each of the possible forms of a lambda expression.
-
The BLL defines three placeholder types: placeholder1_type, placeholder2_type and placeholder3_type.
BLL has a predefined placeholder variable for each placeholder type: _1, _2 and _3.
@@ -78,7 +77,7 @@ For example, the following is a valid lambda expression:
cout << _1, _2[_3] = _1 && false
However, there are some restrictions that originate from the C++ operator overloading rules, and some special cases.
-
+
Some operators cannot be overloaded at all (::, ., .*).
For some operators, the requirements on return types prevent them to be overloaded to create lambda functors.
These operators are ->., ->, new, new[], delete, delete[] and ?: (the conditional operator).
@@ -243,6 +242,7 @@ This creates some asymmetry between the lambda functor and the original member f
class A {
int i; mutable int j;
public:
+
A(int ii, int jj) : i(ii), j(jj) {};
void set_i(int x) { i = x; };
void set_j(int x) const { j = x; };
@@ -281,7 +281,27 @@ A a(0,0);
bind(&A::set_i, _1, 1)(a); // a.i == 1
bind(&A::set_j, _1, 1)(a); // a.j == 1
-
+A pointer to a member variable is not really a function, but
+the first argument to the bind function can nevertheless
+be a pointer to a member variable.
+Invoking such a bind expression returns a reference to the data member.
+For example:
+
+
+struct A { int data; };
+A a;
+bind(&A::data, _1)(a) = 1; // a.data == 1
+
+
+The cv-qualifiers of the object whose member is accessed are respected.
+For example, the following tries to write into a const location:
+
+const A ca = a;
+bind(&A::data, _1)(ca) = 1; // error
+
+
+
Function objects, that is, class objects which have the function call
operator defined, can be used as target functions.
@@ -291,7 +311,7 @@ In general, BLL cannot deduce the return type of an arbitrary function object.
However, there is a method for giving BLL this capability for a certain
function object class.
-
+
To make BLL aware of the return type(s) of a function object one needs to
provide a member template struct
sig<Args> with a typedef
@@ -513,7 +533,7 @@ By using var to make index a lambda expression, we get the des
In sum, var(x) creates a nullary lambda functor,
which stores a reference to the variable x.
When the lambda functor is invoked, a reference to x is returned.
-
+
It is possible to predefine and name a delayed variable or constant outside a lambda expression.
The templates var_type, constant_type
and constant_ref_type serve for this purpose.
@@ -542,7 +562,7 @@ Here is an example of naming a delayed constant:
constant_type<char>::type space(constant(' '));
for_each(a.begin(),a.end(), cout << space << _1);
-
As described in Section 5.2.2, assignment and subscripting operators are always defined as member functions.
This means, that for expressions of the form
x = y or x[y] to be interpreted as lambda expressions, the left-hand operand x must be a lambda expression.
@@ -829,7 +849,7 @@ objects related to creating and destroying objects,
showing the expression to create and call the function object,
and the effect of evaluating that expression.
-
Table 1. Construction and destruction related function objects.
Function object call Wrapped expression constructor<T>()(arg_list) T(arg_list) destructor()(a) a.~A(), where a is of type A destructor()(pa) pa.->A(), where pa is of type A* new_ptr<T>()(arg_list) new T(arg_list) new_array<T>()(sz) new T[sz] delete_ptr()(p) delete p delete_array()(p) delete p[]
+
Table 1. Construction and destruction related function objects.
Function object call Wrapped expression constructor<T>()(arg_list) T(arg_list) destructor()(a) a.~A(), where a is of type A destructor()(pa) pa.->A(), where pa is of type A* new_ptr<T>()(arg_list) new T(arg_list) new_array<T>()(sz) new T[sz] delete_ptr()(p) delete p delete_array()(p) delete p[]
When a lambda functor is called, the default behavior is to substitute
the actual arguments for the placeholders within all subexpressions.
@@ -955,7 +975,7 @@ int nested(const F& f) {
}
-
-
The BLL defines its counterparts for the four cast expressions
@@ -1089,7 +1109,7 @@ int count = 0;
for_each(a.begin(), a.end(),
if_then(ll_dynamic_cast<derived*>(_1), ++var(count)));
-
The BLL counterparts for these expressions are named
ll_sizeof and ll_typeid.
diff --git a/doc/ar01s07.html b/doc/ar01s07.html
index 6784818..8eb44a3 100644
--- a/doc/ar01s07.html
+++ b/doc/ar01s07.html
@@ -5,7 +5,7 @@
The Boost Lambda Library">
In theory, all overhead of using STL algorithms and lambda functors
+ The Boost Lambda Library">
In theory, all overhead of using STL algorithms and lambda functors
compared to hand written loops can be optimized away, just as the overhead
from standard STL function objects and binders can.
@@ -97,7 +97,7 @@ The running times are expressed in arbitrary units." border="1">
<
Some additional performance testing with an earlier version of the
library is described
[Jär00].
-
The BLL uses templates rather heavily, performing numerous recursive instantiations of the same templates.
+
The BLL uses templates rather heavily, performing numerous recursive instantiations of the same templates.
This has (at least) three implications:
While it is possible to write incredibly complex lambda expressions, it probably isn't a good idea.
@@ -111,7 +111,7 @@ This can make the error messages very long and difficult to interpret, particula
The C++ Standard suggests a template nesting level of 17 to help detect infinite recursion.
Complex lambda templates can easily exceed this limit.
Most compilers allow a greater number of nested templates, but commonly require the limit explicitly increased with a command line argument.
-
The BLL works with the following compilers, that is, the compilers are capable of compiling the test cases that are included with the BLL:
- GCC 3.0.4
@@ -120,7 +120,7 @@ The BLL works with the following compilers, that is, the compilers are capable o
)
-The following list describes the test files included and the features that each file covers:
+
The following list describes the test files included and the features that each file covers:
bind_tests_simple.cpp : Bind expressions of different arities and types of target functions: function pointers, function objects and member functions.
diff --git a/doc/ar01s08.html b/doc/ar01s08.html
index 317efed..0a6b004 100644
--- a/doc/ar01s08.html
+++ b/doc/ar01s08.html
@@ -5,7 +5,7 @@
The Boost Lambda Library">
Sometimes it is convenient to store lambda functors in variables.
+ The Boost Lambda Library">
Sometimes it is convenient to store lambda functors in variables.
However, the types of even the simplest lambda functors are long and unwieldy, and it is in general unfeasible to declare variables with lambda functor types.
The Boost Function library [function] defines wrappers for arbitrary function objects, for example
lambda functors; and these wrappers have types that are easy to type out.
@@ -44,7 +44,7 @@ delete sum;
counter(3); // error, *sum does not exist anymore
-
The Boost Bind [bind] library has partially overlapping functionality with the BLL.
Basically, the Boost Bind library (BB in the sequel) implements the bind expression part of BLL.
There are, however, some semantical differerences.
@@ -63,7 +63,7 @@ a larger set of compilers.
The following two sections describe what are the semantic differences
between the bind expressions in BB and BLL.
-
+
In BB the first argument of the bind expression, the target function,
is treated differently from the other arguments,
diff --git a/doc/ar01s09.html b/doc/ar01s09.html
index 619e765..5fb0f83 100644
--- a/doc/ar01s09.html
+++ b/doc/ar01s09.html
@@ -5,7 +5,7 @@
The Boost Lambda Library">
+ The Boost Lambda Library">
The main body of the library was written by Jaakko Järvi and Gary Powell.
We've got outside help, suggestions and ideas from Jeremy Siek, Peter Higley, Peter Dimov, Valentin Bonnard, William Kempf.
diff --git a/doc/bi01.html b/doc/bi01.html
index a52f832..b0cbe63 100644
--- a/doc/bi01.html
+++ b/doc/bi01.html
@@ -5,7 +5,7 @@
The Boost Lambda Library">[STL94] The Standard Template Library. Hewlett-Packard Laboratories. 1994.
+ The Boost Lambda Library">[STL94] The Standard Template Library. Hewlett-Packard Laboratories. 1994.
www.hpl.hp.com/techreports
.
[SGI02] The SGI Standard Template Library. 2002. www.sgi.com/tech/stl/.
[Jär99]
diff --git a/doc/detail/lambda_doc.xml b/doc/detail/lambda_doc.xml
index d7e2d31..7e361ef 100755
--- a/doc/detail/lambda_doc.xml
+++ b/doc/detail/lambda_doc.xml
@@ -1074,6 +1074,7 @@ This creates some asymmetry between the lambda functor and the original member f
class A {
int i; mutable int j;
public:
+
A(int ii, int jj) : i(ii), j(jj) {};
void set_i(int x) { i = x; };
void set_j(int x) const { j = x; };
@@ -1119,6 +1120,32 @@ bind(&A::set_j, _1, 1)(a); // a.j == 1]]>
+
+Member variables as targets
+
+
+A pointer to a member variable is not really a function, but
+the first argument to the bind function can nevertheless
+be a pointer to a member variable.
+Invoking such a bind expression returns a reference to the data member.
+For example:
+
+
+
+
+
+The cv-qualifiers of the object whose member is accessed are respected.
+For example, the following tries to write into a const location:
+
+
+
+
+
+
+
Function objects as targets
diff --git a/doc/index.html b/doc/index.html
index 6cf7144..031323e 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -8,14 +8,14 @@
The Boost Lambda Library">
+ The Boost Lambda Library Next
Copyright © 1999-2002 Jaakko Järvi, Gary Powell
The Boost Lambda Library is free software; Permission to copy,
use, modify and distribute this software and its documentation is granted, provided this copyright
notice appears in all copies.
-
Table of Contents
- 1. In a nutshell
- 2. Getting Started
- 3. Introduction
- 4. Using the library
- 5. Lambda expressions in details
- 5.1. Placeholders
- 5.2. Operator expressions
- 5.3. Bind expressions
- 5.4. Overriding the deduced return type
- 5.5. Delaying constants and variables
- 5.6. Lambda expressions for control structures
- 5.7. Exceptions
- 5.8. Construction and destruction
- 5.9. Special lambda expressions
- 5.10. Casts, sizeof and typeid
- 5.11. Nesting STL algorithm invocations
- 6. Extending return type deduction system
- 7. Practical considerations
- 7.1. Performance
- 7.2. About compiling
- 7.3. Portability
- 8. Relation to other Boost libraries
- 8.1. Boost Function
- 8.2. Boost Bind
- 9. Contributors
- A. Rationale for some of the design decisions
- 1.
+
Table of Contents
- 1. In a nutshell
- 2. Getting Started
- 3. Introduction
- 4. Using the library
- 5. Lambda expressions in details
- 5.1. Placeholders
- 5.2. Operator expressions
- 5.3. Bind expressions
- 5.4. Overriding the deduced return type
- 5.5. Delaying constants and variables
- 5.6. Lambda expressions for control structures
- 5.7. Exceptions
- 5.8. Construction and destruction
- 5.9. Special lambda expressions
- 5.10. Casts, sizeof and typeid
- 5.11. Nesting STL algorithm invocations
- 6. Extending return type deduction system
- 7. Practical considerations
- 7.1. Performance
- 7.2. About compiling
- 7.3. Portability
- 8. Relation to other Boost libraries
- 8.1. Boost Function
- 8.2. Boost Bind
- 9. Contributors
- A. Rationale for some of the design decisions
- Bibliography
diff --git a/doc/lambda_docs_as_one_file.html b/doc/lambda_docs_as_one_file.html
index b5254db..a83ca4b 100644
--- a/doc/lambda_docs_as_one_file.html
+++ b/doc/lambda_docs_as_one_file.html
@@ -1,16 +1,16 @@
C++ BOOST
- The Boost Lambda Library
+ The Boost Lambda LibraryCopyright © 1999-2002 Jaakko Järvi, Gary Powell
The Boost Lambda Library is free software; Permission to copy,
use, modify and distribute this software and its documentation is granted, provided this copyright
notice appears in all copies.
-
Table of Contents
- 1. In a nutshell
- 2. Getting Started
- 3. Introduction
- 4. Using the library
- 5. Lambda expressions in details
- 5.1. Placeholders
- 5.2. Operator expressions
- 5.3. Bind expressions
- 5.4. Overriding the deduced return type
- 5.5. Delaying constants and variables
- 5.6. Lambda expressions for control structures
- 5.7. Exceptions
- 5.8. Construction and destruction
- 5.9. Special lambda expressions
- 5.10. Casts, sizeof and typeid
- 5.11. Nesting STL algorithm invocations
- 6. Extending return type deduction system
- 7. Practical considerations
- 7.1. Performance
- 7.2. About compiling
- 7.3. Portability
- 8. Relation to other Boost libraries
- 8.1. Boost Function
- 8.2. Boost Bind
- 9. Contributors
- A. Rationale for some of the design decisions
- 1.
+
Table of Contents
- 1. In a nutshell
- 2. Getting Started
- 3. Introduction
- 4. Using the library
- 5. Lambda expressions in details
- 5.1. Placeholders
- 5.2. Operator expressions
- 5.3. Bind expressions
- 5.4. Overriding the deduced return type
- 5.5. Delaying constants and variables
- 5.6. Lambda expressions for control structures
- 5.7. Exceptions
- 5.8. Construction and destruction
- 5.9. Special lambda expressions
- 5.10. Casts, sizeof and typeid
- 5.11. Nesting STL algorithm invocations
- 6. Extending return type deduction system
- 7. Practical considerations
- 7.1. Performance
- 7.2. About compiling
- 7.3. Portability
- 8. Relation to other Boost libraries
- 8.1. Boost Function
- 8.2. Boost Bind
- 9. Contributors
- A. Rationale for some of the design decisions
- Bibliography
The Boost Lambda Library (BLL in the sequel) is a C++ template
library, which implements form of lambda abstractions for C++.
@@ -29,7 +29,7 @@ In explaining what the library is about, a line of code says more than a thousan
called with an element of a as the actual argument.
This actual argument is substituted for the placeholder, and the ‘body’ of the function is evaluated.
The essence of BLL is letting you define small unnamed function objects, such as the one above, directly on the call site of an STL algorithm.
-
The library consists of include files only, hence there is no
installation procedure. The boost include directory
must be on the include path.
@@ -65,14 +65,14 @@ Cast expressions
Tuple [tuple] and the type_traits [type_traits] libraries, and on the boost/ref.hpp header.
All definitions are placed in the namespace boost::lambda and its subnamespaces.
-
In most code examples, we omit the namespace prefixes for names in the std and boost::lambda namespaces.
+
The Standard Template Library (STL)
[STL94], now part of the C++ Standard Library [C++98], is a generic container and algorithm library.
Typically STL algorithms operate on container elements via function objects. These function objects are passed as arguments to the algorithms.
@@ -172,7 +172,7 @@ as function composition is supported implicitly.
-
Lambda expression are common in functional programming languages.
Their syntax varies between languages (and between different forms of lambda calculus), but the basic form of a lambda expressions is:
@@ -254,7 +254,7 @@ There are quite a lot of exceptions and special cases, but discussion of them is
list<int> v(10);
for_each(v.begin(), v.end(), _1 = 1);
- The expression _1 = 1 creates a lambda functor which assigns the value 1 to every element in v.[1]
+ The expression _1 = 1 creates a lambda functor which assigns the value 1 to every element in v.[1]
Next, we create a container of pointers and make them point to the elements in the first container v:
@@ -445,7 +445,6 @@ This section describes different categories of lambda expressions in details.
We devote a separate section for each of the possible forms of a lambda expression.
-
The BLL defines three placeholder types: placeholder1_type, placeholder2_type and placeholder3_type.
BLL has a predefined placeholder variable for each placeholder type: _1, _2 and _3.
@@ -513,7 +512,7 @@ For example, the following is a valid lambda expression:
cout << _1, _2[_3] = _1 && false
However, there are some restrictions that originate from the C++ operator overloading rules, and some special cases.
-
+
Some operators cannot be overloaded at all (::, ., .*).
For some operators, the requirements on return types prevent them to be overloaded to create lambda functors.
These operators are ->., ->, new, new[], delete, delete[] and ?: (the conditional operator).
@@ -678,6 +677,7 @@ This creates some asymmetry between the lambda functor and the original member f
class A {
int i; mutable int j;
public:
+
A(int ii, int jj) : i(ii), j(jj) {};
void set_i(int x) { i = x; };
void set_j(int x) const { j = x; };
@@ -716,7 +716,27 @@ A a(0,0);
bind(&A::set_i, _1, 1)(a); // a.i == 1
bind(&A::set_j, _1, 1)(a); // a.j == 1
-
+A pointer to a member variable is not really a function, but
+the first argument to the bind function can nevertheless
+be a pointer to a member variable.
+Invoking such a bind expression returns a reference to the data member.
+For example:
+
+
+struct A { int data; };
+A a;
+bind(&A::data, _1)(a) = 1; // a.data == 1
+
+
+The cv-qualifiers of the object whose member is accessed are respected.
+For example, the following tries to write into a const location:
+
+const A ca = a;
+bind(&A::data, _1)(ca) = 1; // error
+
+
+
Function objects, that is, class objects which have the function call
operator defined, can be used as target functions.
@@ -726,7 +746,7 @@ In general, BLL cannot deduce the return type of an arbitrary function object.
However, there is a method for giving BLL this capability for a certain
function object class.
-
+
To make BLL aware of the return type(s) of a function object one needs to
provide a member template struct
sig<Args> with a typedef
@@ -948,7 +968,7 @@ By using var to make index a lambda expression, we get the des
In sum, var(x) creates a nullary lambda functor,
which stores a reference to the variable x.
When the lambda functor is invoked, a reference to x is returned.
-
+
It is possible to predefine and name a delayed variable or constant outside a lambda expression.
The templates var_type, constant_type
and constant_ref_type serve for this purpose.
@@ -977,7 +997,7 @@ Here is an example of naming a delayed constant:
constant_type<char>::type space(constant(' '));
for_each(a.begin(),a.end(), cout << space << _1);
-
As described in Section 5.2.2, assignment and subscripting operators are always defined as member functions.
This means, that for expressions of the form
x = y or x[y] to be interpreted as lambda expressions, the left-hand operand x must be a lambda expression.
@@ -1264,7 +1284,7 @@ objects related to creating and destroying objects,
showing the expression to create and call the function object,
and the effect of evaluating that expression.
-
Table 1. Construction and destruction related function objects.
Function object call Wrapped expression constructor<T>()(arg_list) T(arg_list) destructor()(a) a.~A(), where a is of type A destructor()(pa) pa.->A(), where pa is of type A* new_ptr<T>()(arg_list) new T(arg_list) new_array<T>()(sz) new T[sz] delete_ptr()(p) delete p delete_array()(p) delete p[]
+
Table 1. Construction and destruction related function objects.
Function object call Wrapped expression constructor<T>()(arg_list) T(arg_list) destructor()(a) a.~A(), where a is of type A destructor()(pa) pa.->A(), where pa is of type A* new_ptr<T>()(arg_list) new T(arg_list) new_array<T>()(sz) new T[sz] delete_ptr()(p) delete p delete_array()(p) delete p[]
When a lambda functor is called, the default behavior is to substitute
the actual arguments for the placeholders within all subexpressions.
@@ -1390,7 +1410,7 @@ int nested(const F& f) {
}
-
-
The BLL defines its counterparts for the four cast expressions
@@ -1524,7 +1544,7 @@ int count = 0;
for_each(a.begin(), a.end(),
if_then(ll_dynamic_cast<derived*>(_1), ++var(count)));
-
The BLL counterparts for these expressions are named
ll_sizeof and ll_typeid.
@@ -1797,7 +1817,7 @@ public:
Note, that we are reusing the existing specializations for the
BLL return_type_2 template,
which require that the argument types are references.
-
+ arithmetic_action<plus_action> - arithmetic_action<minus_action> * arithmetic_action<multiply_action> / arithmetic_action<divide_action> % arithmetic_action<remainder_action> + unary_arithmetic_action<plus_action> - unary_arithmetic_action<minus_action> & bitwise_action<and_action> | bitwise_action<or_action> ~ bitwise_action<not_action> ^ bitwise_action<xor_action> << bitwise_action<leftshift_action_no_stream> >> bitwise_action<rightshift_action_no_stream> && logical_action<and_action> || logical_action<or_action> ! logical_action<not_action> < relational_action<less_action> > relational_action<greater_action> <= relational_action<lessorequal_action> >= relational_action<greaterorequal_action> == relational_action<equal_action> != relational_action<notequal_action> += arithmetic_assignment_action<plus_action> -= arithmetic_assignment_action<minus_action> *= arithmetic_assignment_action<multiply_action> /= arithmetic_assignment_action<divide_action> %= arithmetic_assignment_action<remainder_action> &= bitwise_assignment_action<and_action> =| bitwise_assignment_action<or_action> ^= bitwise_assignment_action<xor_action> <<= bitwise_assignment_action<leftshift_action> >>= bitwise_assignment_action<rightshift_action> ++ pre_increment_decrement_action<increment_action> -- pre_increment_decrement_action<decrement_action> ++ post_increment_decrement_action<increment_action> -- post_increment_decrement_action<decrement_action> & other_action<address_of_action> * other_action<contents_of_action> , other_action<comma_action>
In theory, all overhead of using STL algorithms and lambda functors
+
+ arithmetic_action<plus_action> - arithmetic_action<minus_action> * arithmetic_action<multiply_action> / arithmetic_action<divide_action> % arithmetic_action<remainder_action> + unary_arithmetic_action<plus_action> - unary_arithmetic_action<minus_action> & bitwise_action<and_action> | bitwise_action<or_action> ~ bitwise_action<not_action> ^ bitwise_action<xor_action> << bitwise_action<leftshift_action_no_stream> >> bitwise_action<rightshift_action_no_stream> && logical_action<and_action> || logical_action<or_action> ! logical_action<not_action> < relational_action<less_action> > relational_action<greater_action> <= relational_action<lessorequal_action> >= relational_action<greaterorequal_action> == relational_action<equal_action> != relational_action<notequal_action> += arithmetic_assignment_action<plus_action> -= arithmetic_assignment_action<minus_action> *= arithmetic_assignment_action<multiply_action> /= arithmetic_assignment_action<divide_action> %= arithmetic_assignment_action<remainder_action> &= bitwise_assignment_action<and_action> =| bitwise_assignment_action<or_action> ^= bitwise_assignment_action<xor_action> <<= bitwise_assignment_action<leftshift_action> >>= bitwise_assignment_action<rightshift_action> ++ pre_increment_decrement_action<increment_action> -- pre_increment_decrement_action<decrement_action> ++ post_increment_decrement_action<increment_action> -- post_increment_decrement_action<decrement_action> & other_action<address_of_action> * other_action<contents_of_action> , other_action<comma_action>
In theory, all overhead of using STL algorithms and lambda functors
compared to hand written loops can be optimized away, just as the overhead
from standard STL function objects and binders can.
@@ -1889,7 +1909,7 @@ The running times are expressed in arbitrary units." border="1">
<
Some additional performance testing with an earlier version of the
library is described
[Jär00].
-
The BLL uses templates rather heavily, performing numerous recursive instantiations of the same templates.
+
The BLL uses templates rather heavily, performing numerous recursive instantiations of the same templates.
This has (at least) three implications:
While it is possible to write incredibly complex lambda expressions, it probably isn't a good idea.
@@ -1903,7 +1923,7 @@ This can make the error messages very long and difficult to interpret, particula
The C++ Standard suggests a template nesting level of 17 to help detect infinite recursion.
Complex lambda templates can easily exceed this limit.
Most compilers allow a greater number of nested templates, but commonly require the limit explicitly increased with a command line argument.
-
The BLL works with the following compilers, that is, the compilers are capable of compiling the test cases that are included with the BLL:
- GCC 3.0.4
@@ -1912,7 +1932,7 @@ The BLL works with the following compilers, that is, the compilers are capable o
)
-The following list describes the test files included and the features that each file covers:
+
The following list describes the test files included and the features that each file covers:
bind_tests_simple.cpp : Bind expressions of different arities and types of target functions: function pointers, function objects and member functions.
@@ -1958,7 +1978,7 @@ Contains several user defined operators and the corresponding specializations fo
Contains tests for using boost::function together with lambda functors.
-Sometimes it is convenient to store lambda functors in variables.
However, the types of even the simplest lambda functors are long and unwieldy, and it is in general unfeasible to declare variables with lambda functor types.
The Boost Function library [function] defines wrappers for arbitrary function objects, for example
lambda functors; and these wrappers have types that are easy to type out.
@@ -1997,7 +2017,7 @@ delete sum;
counter(3); // error, *sum does not exist anymore
-
The Boost Bind [bind] library has partially overlapping functionality with the BLL.
Basically, the Boost Bind library (BB in the sequel) implements the bind expression part of BLL.
There are, however, some semantical differerences.
@@ -2016,7 +2036,7 @@ a larger set of compilers.
The following two sections describe what are the semantic differences
between the bind expressions in BB and BLL.
-
+
In BB the first argument of the bind expression, the target function,
is treated differently from the other arguments,
@@ -2074,7 +2094,7 @@ performance hit, particularly for the simplest (and thus the most common)
lambda functors.
We are working on a hybrid approach, which will allow more placeholders
but not compromise the performance of simple lambda functors.
-
The main body of the library was written by Jaakko Järvi and Gary Powell.
We've got outside help, suggestions and ideas from Jeremy Siek, Peter Higley, Peter Dimov, Valentin Bonnard, William Kempf.
@@ -2082,7 +2102,7 @@ We would particularly like to mention Joel de Guzmann and his work with
Phoenix which has influenced BLL significantly, making it considerably simpler
to extend the library with new features.
-A. Rationale for some of the design decisions
A. Rationale for some of the design decisions
The highest placeholder index in a lambda expression determines the arity of the resulting function object.
@@ -2135,7 +2155,7 @@ the error would go unnoticed.
Furthermore, weak arity checking simplifies the implementation a bit.
Following the recommendation of the Boost review, strict arity checking
was dropped.
-
[STL94] The Standard Template Library. Hewlett-Packard Laboratories. 1994.
www.hpl.hp.com/techreports
.
[SGI02] The SGI Standard Template Library. 2002. www.sgi.com/tech/stl/.
[bind] Boost Bind Library. www.boost.org/libs/bind/bind.html
. 2002.
[function] Boost Function Library. www.boost.org/libs/function/
. 2002.
[fc++] The FC++ library: Functional Programming in C++. www.cc.gatech.edu/~yannis/fc++/
-. 2002.
[1]
Strictly taken, the C++ standard defines for_each as a non-modifying sequence operation, and the function object passed to for_each should not modify its argument.
The requirements for the arguments of for_each are unnecessary strict, since as long as the iterators are mutable, for_each accepts a function object that can have side-effects on their argument.
Nevertheless, it is straightforward to provide another function template with the functionality ofstd::for_each but more fine-grained requirements for its arguments.