• not2

• bind1st

• bind2nd

• ptr_fun

Notes

[1] The reason for the name 'adaptable function object' is that adaptable function objects may be used by function object adaptors.

[2] The unary_function and binary_function bases are similar to the input_iterator, output_iterator, forward_iterator, bidirectional_iterator, and random_access_iterator bases: they are completely empty, and serve only to provide type information.

[3] This is an example of how to use function objects; it is not the recommended way of calculating the sum of elements in a vector. The accumulate algorithm is a better way of calculating a sum.

Concepts

Generator

Category: functors

Component type: concept

Description

A Generator is a kind of function object: an object that is called as if it were an ordinary C++ function. A Generator is called with no arguments.

Refinement of

Assignable

Associated types
Result type The type returned when the Generator is called
Notation

F A type that is a model of Generator

Result The result type of F

f Object of type F

Definitions

The range of a Generator is the set of all possible value that it may return.

Valid expressions
Name Expression Return type
Function call f() Result
Expression semantics
Name Expression Semantics Postcondition
Function call f() Returns some value of type Result [1] The return value is in f 's range.
Models

• Result (*)()

Notes

[1] Two different invocations of f may return different results: a Generator may refer to local state, perform I/O, and so on. The expression f() is permitted to change f's state; f might, for example, represent a pseudo-random number generator.

See also

Function Object overview, Unary Function, Binary Function, Adaptable Generator

Unary Function

Category: functors

Component type: concept

Description

A Unary Function is a kind of function object: an object that is called as if it were an ordinary C++ function. A Unary Function is called with a single argument.

Refinement of

Assignable

Associated types
Argument type The type of the Unary Function's argument.
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату