Standard Template Library Programmer's Guide

Здесь есть возможность читать онлайн «Standard Template Library Programmer's Guide» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Программирование, Справочники, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Standard Template Library Programmer's Guide: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Standard Template Library Programmer's Guide»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

This document contains reference on SGI STL implementation

Standard Template Library Programmer's Guide — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Standard Template Library Programmer's Guide», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать
Public base classes

binary_function

Members
Member Where defined Description
first_argument_type Adaptable Binary Function The type of project1st 's first argument: Arg1
second_argument_type Adaptable Binary Function The type of project1st 's second argument: Arg2
result_type Adaptable Binary Function The type of the result: Arg1 .
Arg1 operator()(const Arg1& x, const Arg2&) const Adaptable Binary Function Function call. The return value is x .
New members

All of project1st 's members are defined in the Adaptable Binary Function requirements. project1st does not introduce any new members.

See also

Function objects, identity , project2nd , select1st , select2nd

project2nd

Category: functors

Component type: type

Description

Project2nd is a function object that takes two arguments and returns its second argument; the first argument is unused. It is essentially a generalization of identity to the case of a Binary Function.

Example

int main() {

vector v1(10, (char*) 0);

vector v2(10, 137);

vector result(10);

transform(v1.begin(), v1.end(), v2.begin(), result.begin(), project2nd());

assert(equal(v2.begin(), v2.end(), result.begin()));

}

Definition

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

Template parameters
Parameter Description
Arg1 project2nd 's first argument type.
Arg2 project2nd 's second argument type, and its result type.
Model of

Adaptable Binary Function

Type requirements

None.

Public base classes

binary_function

Members
Member Where defined Description
first_argument_type Adaptable Binary Function The type of project2nd 's first argument: Arg1
second_argument_type Adaptable Binary Function The type of project2nd 's second argument: Arg2
result_type Adaptable Binary Function The type of the result: Arg2 .
Arg1 operator()(const Arg1&, const Arg2& y) const Adaptable Binary Function Function call. The return value is y .
New members

All of project2nd 's members are defined in the Adaptable Binary Function requirements. project2nd does not introduce any new members.

See also

Function objects, identity , project1st , select1st , select2nd

select1st

Category: functors

Component type: type

Description

Select1st is a function object that takes a single argument, a pair [1], and returns the pair's first element.

Example

Print all of a map 's keys.

int main() {

map M;

M[1] = 0.3;

M[47] = 0.8;

M[33] = 0.1;

transform(M.begin(), M.end(), ostream_iterator(cout, " "), select1st::value_type>());

// The output is 1 33 47.

}

Definition

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

Template parameters
Parameter Description
Pair The function object's argument type.
Model of

Adaptable Unary Function

Type requirements

There exist some types U and V such that Pair provides the same interface as a pair . [1]

Public base classes

unary_function

Members
Member Where defined Description
argument_type Adaptable Unary Function The type of select1st 's argument: Pair
result_type Adaptable Unary Function The type of the result: Pair::first_type
const Pair::first_type& operator()(const Pair& p) const Adaptable Unary Function Function call. The return value is p.first .
New members

All of select1st 's members are defined in the Adaptable Unary Function requirements. Select1st does not introduce any new members.

Notes

[1] Pair is not actually required to be a pair , but merely to support the same interface as pair . In almost all cases the template parameter will be a pair , but it is occasionally useful for it to be something else. One example is a struct that has the members first , second , and third .

See also

identity , select2nd , project1st , project2nd

select2nd

Category: functors

Component type: type

Description

Select2nd is a function object that takes a single argument, a pair [1], and returns the pair's second element.

Example

Print all of a map 's values.

int main() {

map M;

M[1] = 0.3;

M[47] = 0.8;

M[33] = 0.1;

transform(M.begin(), M.end(), ostream_iterator(cout, " "), select2nd::value_type>());

// The output is 0.3 0.1 0.8

}

Definition

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

Template parameters
Parameter Description
Pair The function object's argument type.
Model of

Adaptable Unary Function

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Standard Template Library Programmer's Guide»

Представляем Вашему вниманию похожие книги на «Standard Template Library Programmer's Guide» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Standard Template Library Programmer's Guide»

Обсуждение, отзывы о книге «Standard Template Library Programmer's Guide» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x