Public base classes

unary_function<T, bool>

Members
Member Where defined Description
argument_type Adaptable Unary Function The type of the second argument: T
result_type Adaptable Unary Function The type of the result: bool
bool operator()(const T& x) const Unary Function Function call operator. The return value is !x.
logical_not() Default Constructible The default constructor.
See also

The function object overview, logical_or, logical_and.

Generalized identity operations

identity<T>

Category: functors

Component type: type

Description

Identity is a Unary Function that represents the identity function: it takes a single argument x, and returns x.

Example

int main() {

 int x = 137;

 identity<int> id;

 assert(x == id(x));

}

Definition

Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h. This class is an SGI extension; it is not part of the C++ standard.

Template parameters
Parameter Description
T The function object's argument type, and return type. [1]
Model of

Adaptable Unary Function

Type requirements

None.

Public base classes

unary_function<T, T>

Members
Member Where defined Description
argument_type Adaptable Unary Function The type of identity's argument: T.
result_type Adaptable Unary Function The type of the result: T. [1]
const T& operator()(const T&) const Adaptable Unary Function Function call. The return value is simply the argument.
New members

All of identity's members are defined in the Adaptable Unary Function

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

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

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