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», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

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

Интервал:

Закладка:

Сделать
Member Description
pointer_to_binary_function(Result (*f)(Arg1, Arg2)) The constructor. Creates a pointer_to_binary_function whose underlying function is f .
pointer_to_binary_function() The default constructor. This creates a pointer_to_binary_function that does not have an underlying function, and that therefore cannot actually be called.
template pointer_to_unary_function ptr_fun(Result (*x)(Arg1, Arg2)); If f is of type Result (*)(Arg1, Arg2) then ptr_fun(f) is equivalent to pointer_to_binary_function(f) , but more convenient. This is a global function, not a member function.
See also

pointer_to_unary_function , ptr_fun , Adaptable Binary Function

unary_negate

Categories: functors, adaptors

Component type: type

Description

Unary_negate is a function object adaptor: it is an Adaptable Predicate that represents the logical negation of some other Adaptable Predicate. That is: if f is an object of class unary_negate , then there exists an object pred of class AdaptablePredicate such that f(x) always returns the same value as !pred(x) . [1] There is rarely any reason to construct a unary_negate directly; it is almost always easier to use the helper function not1 .

Example

Finds the first element in a list that does not lie in the range from 1 to 10.

list L;

list::iterator in_range = find_if(L.begin(), L.end(), not1(compose2(logical_and(), bind2nd(greater_equal(), 1), bind2nd(less_equal(), 10))));

assert(in_range == L.end() || !(*in_range >= 1 && *in_range <= 10));

Definition

Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.

Template parameters
Parameter Description
AdaptablePredicate The type of the function object that this unary_negate is the logical negation of.
Model of

Adaptable Predicate

Type requirements

AdaptablePredicate must be a model of Adaptable Predicate.

Public base classes

unary_function

Members
Member Where defined Description
argument_type Adaptable Unary Function The type of the argument: AdaptablePredicate::argument_type
result_type Adaptable Unary Function The type of the result: bool
bool operator()(argument_type) Unary Function Function call operator.
unary_negate(const AdaptablePredicate& pred) unary_negate See below.
template unary_negate not1(const AdaptablePredicate& pred); unary_negate See below.
New members

These members are not defined in the Adaptable Predicate requirements, but are specific to unary_negate .

Member Description
unary_negate(const AdaptablePredicate& pred) The constructor. Creates a unary_negate whose underlying predicate is pred .
template unary_negate not1(const AdaptablePredicate& pred); If p is of type AdaptablePredicate then not1(p) is equivalent to unary_negate(p) , but more convenient. This is a global function, not a member function.
Notes

[1] Strictly speaking, unary_negate is redundant. It can be constructed using the function object logical_not and the adaptor unary_compose .

See also

The function object overview, Adaptable Predicate, Predicate, binary_negate , unary_compose , binary_compose

binary_negate

Categories: functors, adaptors

Component type: type

Description

Binary_negate is a function object adaptor: it is an Adaptable Binary Predicate that represents the logical negation of some other Adaptable Binary Predicate . That is: if f is an object of class binary_negate , then there exists an object pred of class AdaptableBinaryPredicate such that f(x,y) always returns the same value as !pred(x,y) . There is rarely any reason to construct a binary_negate directly; it is almost always easier to use the helper function not2 .

Example

Finds the first character in a string that is neither ' ' nor '\n' .

char str[MAXLEN];

const char* wptr = find_if(str, str + MAXLEN, compose2(not2(logical_or()), bind2nd(equal_to(), ' '), bind2nd(equal_to(), '\n')));

assert(wptr == str + MAXLEN || !(*wptr == ' ' || *wptr == '\n'));

Definition

Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.

Template parameters
Parameter Description
AdaptableBinaryPredicate The type of the function object that this binary_negate is the logical negation of.
Model of

Adaptable Binary Predicate

Type requirements

AdaptableBinaryPredicate must be a model of Adaptable Binary Predicate.

Public base classes

binary_function

Members
Member Where defined Description
first_argument_type Adaptable Binary Function The type of the first argument: AdaptableBinaryPredicate::first_argument_type
second_argument_type Adaptable Binary Function The type of the second argument: AdaptableBinaryPredicate::second_argument_type
result_type Adaptable Binary Function The type of the result: bool
binary_negate(const AdaptableBinaryPredicate& pred) binary_negate See below.
template binary_negate not2(const AdaptableBinaryPredicate& pred); binary_negate See below.
New members

These members are not defined in the Adaptable Binary Predicate requirements, but are specific to binary_negate .

Member Description
binary_negate(const AdaptableBinaryPredicate& pred) The constructor. Creates a binary_negate whose underlying predicate is pred .
template binary_negate not2(const AdaptableBinaryPredicate& pred); If p is of type AdaptableBinaryPredicate then not2(p) is equivalent to binary_negate(p) , but more convenient. This is a global function, not a member function.
See also

The function object overview, AdaptablePredicate, Predicate, unary_negate , unary_compose , binary_compose

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

Интервал:

Закладка:

Сделать

Похожие книги на «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