Ru-Brd |
The STL part of the C++ standard library uses the concept of functors. For example, all algorithms use functors to customize their exact behavior. Many of these functors are so-called predicates . Predicates are functions or function objects that return a Boolean value (a value that is convertible to bool ). The predicates, in general, should be pure functors; otherwise , unexpected results may occur (see Section 8.1.4 of [JosuttisStdLib]). The C++ standard library also provides several standard functors and adapters for composition. In fact, for every common unary and binary operator a function object is provided. See Sections 8.2 and 8.3 of [JosuttisStdLib] for details. However, note that the C++ standard library does not provide enough adapters to support every functional behavior as a combination of function objects. For example, it is not possible to combine the results of two unary operations to formulate a criterion such as "this and that." The Boost repository of C++ libraries provides supplementary adapters that fill this gap (see [BoostCompose]). |
Ru-Brd |