The type returned when the Unary Function is called
Notation

F A type that is a model of Unary Function

Valid expressions

None, except for those defined by Unary Function

Models

• negate

• identity

• pointer_to_unary_function

Notes

[1] Note the implication of this: a function pointer T (*f)(X) is a Unary Function, but not an Adaptable Unary Function: the expressions f::argument_type and f::result_type are nonsensical.

[2] When you define a class that is a model of Adaptable Unary Function, you must provide these typedefs. The easiest way to do this is to derive the class from the base class unary_function. This is an empty class, with no member functions or member variables; the only reason it exists is to make defining Adaptable Unary Functions more convenient. Unary_function is very similar to the base classes used by the iterator tag functions.

See also

Unary Function, Adaptable Generator, Adaptable Binary Function

Adaptable Binary Function

Category: functors

Component type: concept

Description

An Adaptable Binary Function is a Binary Function with nested typedefs that define its argument types and result type. [1] [2] These nested typedefs make it possible to use function object adaptors.

Refinement of

Binary Function

Associated types
First argument type F::first_argument_type The type of F's first argument
Second argument type F::second_argument_type The type of F's second argument
Result type F::result_type The type returned when the Binary Function is called
Notation

F A type that is a model of Binary Function

Valid expressions

None, except for those defined by Binary Function

Models

• plus

• project1st

• pointer_to_binary_function

Notes

[1] Note the implication of this: a function pointer T (*f)(X,Y) is a Binary Function, but not an Adaptable Binary Function: the expressions f::first_argument_type, f::second_argument_type, and f::result_type are nonsensical.

[2] When you define a class that is a model of Adaptable Binary Function, you must provide these typedefs. The easiest way to do this is to derive the class from the base class binary_function. This is an empty class, with no member functions or member variables; the only reason it exists is to make defining Adaptable Binary Functions more convenient. Binary_function is very similar to the base classes used by the iterator tag functions.

See also

Binary Function, Adaptable Generator, Adaptable Unary Function

Predicates

Predicate

Category: functors

Component type: concept

Description

A Predicate is a Unary Function whose result represents the truth or falsehood of some condition. A Predicate might, for example, be a function that takes an argument of type int and returns true if the argument is positive.

Refinement of

Unary Function

Associated types
Result type The type returned when the Predicate is called. The result type must be convertible to bool.
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

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

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