Standard Template Library Programmer's Guide
Здесь есть возможность читать онлайн «Standard Template Library Programmer's Guide» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Программирование, Справочники, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Standard Template Library Programmer's Guide
- Автор:
- Жанр:
- Год:неизвестен
- ISBN:нет данных
- Рейтинг книги:4 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 80
- 1
- 2
- 3
- 4
- 5
Standard Template Library Programmer's Guide: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Standard Template Library Programmer's Guide»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Standard Template Library Programmer's Guide — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Standard Template Library Programmer's Guide», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
| Member | Description |
|---|---|
binder1st(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::first_argument_type c) |
The constructor. Creates a binder1st such that calling it with the argument x (where x is of type AdaptableBinaryFunction::second_argument_type ) corresponds to the call F(c, x) . |
template binder1st bind1st(const AdaptableBinaryFunction& F, const T& c); |
If F is an object of type AdaptableBinaryFunction , then bind1st(F, c) is equivalent to binder1st(F, c) , but is more convenient. The type T must be convertible to AdaptableBinaryFunction::first_argument_type . This is a global function, not a member function. |
[1] Intuitively, you can think of this operation as "binding" the first argument of a binary function to a constant, thus yielding a unary function. This is a special case of a closure.
The function object overview, binder2nd , Adaptable Unary Function, Adaptable Binary Function
binder2nd
Categories: functors, adaptors
Component type: type
Binder2nd is a function object adaptor: it is used to transform an adaptable binary function into an adaptable unary function. Specifically, if f is an object of class binder2nd , then f(x) returns F(x, c) , where F is an object of class AdaptableBinaryFunction and where c is a constant. Both F and c are passed as arguments to binder2nd 's constructor. [1]
The easiest way to create a binder2nd is not to call the constructor explicitly, but instead to use the helper function bind2nd .
Finds the first positive number in a list.
list L;
…
list::iterator first_positive = find_if(L.begin(), L.end(), bind2nd(greater(), 0));
assert(first_positive == L.end() || *first_positive > 0);
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.
| Parameter | Description |
|---|---|
AdaptableBinaryFunction |
The type of the binary function whose second argument is being bound to a constant. |
Adaptable Unary Function
AdaptableBinaryFunction must be a model of Adaptable Binary Function.
unary_function
| Member | Where defined | Description |
|---|---|---|
argument_type |
Adaptable Unary Function | The type of the function object's argument, which is AdaptableBinaryFunction::first_argument_type |
result_type |
Adaptable Unary Function | The type of the result: AdaptableBinaryFunction::result_type |
result_type operator()(const argument_type& x) const |
Adaptable Unary Function | Function call. Returns F(x, c) , where F and c are the arguments with which this binder1st was constructed. |
binder2nd(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::second_argument_type c) |
binder2nd |
See below |
template binder2nd bind2nd(const AdaptableBinaryFunction& F, const T& c); |
binder2nd |
See below |
These members are not defined in the Adaptable Unary Function requirements, but are specific to binder2nd .
| Member | Description |
|---|---|
binder2nd(const AdaptableBinaryFunction& F, AdaptableBinaryFunction::second_argument_type c) |
The constructor. Creates a binder2nd such that calling it with the argument x (where x is of type AdaptableBinaryFunction::first_argument_type ) corresponds to the call F(x, c) . |
template binder2nd bind2nd(const AdaptableBinaryFunction& F, const T& c); |
If F is an object of type AdaptableBinaryFunction , then bind2nd(F, c) is equivalent to binder2nd(F, c) , but is more convenient. The type T must be convertible to AdaptableBinaryFunction::second_argument_type . This is a global function, not a member function. |
[1] Intuitively, you can think of this operation as "binding" the second argument of a binary function to a constant, thus yielding a unary function. This is a special case of a closure.
The function object overview, binder1st , Adaptable Unary Function, Adaptable Binary Function
ptr_fun
Categories: functors, adaptors
Component type: function
template
pointer_to_unary_function ptr_fun(Result (*x)(Arg));
template
pointer_to_binary_function ptr_fun(Result (*x)(Arg1, Arg2));
Ptr_fun takes a function pointer as its argument and returns a function pointer adaptor, a type of function object. It is actually two different functions, not one (that is, the name ptr_fun is overloaded). If its argument is of type Result (*)(Arg) then ptr_fun creates a pointer_to_unary_function , and if its argument is of type Result (*)(Arg1, Arg2) then ptr_fun creates a pointer_to_binary_function .
Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.
The argument must be a pointer to a function that takes either one or two arguments. The argument type(s) and the return type of the function are arbitrary, with the restriction that the function must return a value; it may not be a void function.
See the examples in the discussions of pointer_to_unary_function and pointer_to_binary_function .
Function Objects, pointer_to_unary_function , pointer_to_binary_function , Adaptable Unary Function, Adaptable Binary Function
pointer_to_unary_function
Categories: functors, adaptors
Component type: type
Pointer_to_unary_function is a function object adaptor that allows a function pointer Result (*f)(Arg) to be treated as an Adaptable Unary Function. That is: if F is a pointer_to_unary_function that was initialized with an underlying function pointer f of type Result (*)(Arg) , then F(x) calls the function f(x) . The difference between f and F is that pointer_to_unary_function is an Adaptable Unary Function, i.e. it defines the nested typedef s argument_type and result_type .
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Standard Template Library Programmer's Guide»
Представляем Вашему вниманию похожие книги на «Standard Template Library Programmer's Guide» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Standard Template Library Programmer's Guide» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.