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

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

Интервал:

Закладка:

Сделать
Function Description
iterator previous(iterator pos) pos must be a valid iterator in *this . The return value is an iterator prev such that ++prev == pos . Complexity: linear in the number of iterators in the range [begin(), pos) .
const_iterator previous(const_iterator pos) pos must be a valid iterator in *this . The return value is an iterator prev such that ++prev == pos . Complexity: linear in the number of iterators in the range [begin(), pos) .
iterator insert_after(iterator pos) pos must be a dereferenceable iterator in *this . (That is, pos may not be end() .) Inserts a copy of T() immediately followingpos . The return value is an iterator that points to the new element. Complexity: constant time.
iterator insert_after(iterator pos, const value_type& x) pos must be a dereferenceable iterator in *this . (That is, pos may not be end() .) Inserts a copy of x immediately followingpos . The return value is an iterator that points to the new element. Complexity: constant time.
template void insert_after(iterator pos, InputIterator f, InputIterator l) Inserts elements from the range [f, l) immediately followingpos . Complexity: linear in last – first .
void insert_after(iterator pos, size_type n, const value_type& x) Inserts n copies of x immediately followingpos . Complexity: linear in n .
iterator erase_after(iterator pos) Erases the element pointed to by the iterator followingpos . Complexity: constant time.
iterator erase_after(iterator before_first, iterator last) Erases all elements in the range [before_first + 1, last) . Complexity: linear in last – (before_first + 1) .
void splice(iterator position, slist& x); position must be a valid iterator in *this , and x must be an slist that is distinct from *this . (That is, it is required that &x != this .) All of the elements of x are inserted before position and removed from x . All iterators remain valid, including iterators that point to elements of x . [4] Complexity: proportional to c1 (position – begin()) + c2(x.size()) , where c1 and c2 are unknown constants.
void splice(iterator position, slist& x, iterator i); position must be a valid iterator in *this , and i must be a dereferenceable iterator in x . Splice moves the element pointed to by i from x to *this , inserting it before position . All iterators remain valid, including iterators that point to elements of x . [4] If position == i or position == ++i , this function is a null operation. Complexity: proportional to c1(position – begin()) + c2(i – x.begin()) , where c1 and c2 are unknown constants.
void splice(iterator position, slist& x, iterator f, iterator l); position must be a valid iterator in *this , and [first, last) must be a valid range in x . position may not be an iterator in the range [first, last) . Splice moves the elements in [first, last) from x to *this , inserting them before position . All iterators remain valid, including iterators that point to elements of x . [4] Complexity: proportional to c1(position – begin()) + c2(f – x.begin()) + c3(l – f) , where c1 , c2 , and c3 are unknown constants.
void remove(const T& val); Removes all elements that compare equal to val . The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid. This function is linear time: it performs exactly size() comparisons for equality.
void splice_after(iterator pos, iterator prev) pos must be a dereferenceable iterator in *this , and prev must be a dereferenceable iterator either in *this or in some other slist . (Note: "dereferenceable iterator" implies that neither pos nor prev may be an off-the-end iterator.) Moves the element followingprev to *this , inserting it immediately afterpos . Complexity: constant time.
void splice_after(iterator pos, iterator before_first, iterator before_last) pos must be a dereferenceable iterator in *this , and before_first and before_last must be dereferenceable iterators either in *this or in some other slist . (Note: "dereferenceable iterator" implies that none of these iterators may be off-the-end iterators.) Moves the elements in the range [before_first + 1, before_last + 1) to *this , inserting them immediately afterpos . Complexity: constant time.
template void remove_if(Predicate p);[5] Removes all elements *i such that p(*i) is true. The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid. This function is linear time: it performs exactly size() applications of p .
void unique(); Removes all but the first element in every consecutive group of equal elements. The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid. This function is linear time: it performs exactly size() – 1 comparisons for equality.
template void unique(BinaryPredicate p);[5] Removes all but the first element in every consecutive group of equivalent elements, where two elements *i and *j are considered equivalent if p(*i, *j) is true. The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid. This function is linear time: it performs exactly size() – 1 comparisons for equality.
void merge(slist& x); Both *this and x must be sorted according to operator< , and they must be distinct. (That is, it is required that &x != this .) This function removes all of x 's elements and inserts them in order into *this . The merge is stable; that is, if an element from *this is equivalent to one from x , then the element from *this will precede the one from x . All iterators to elements in *this and x remain valid. This function is linear time: it performs at most size() + x.size() – 1 comparisons.
template void merge(slist& x, BinaryPredicate Comp);[5] Comp must be a comparison function that induces a strict weak ordering (as defined in the LessThan Comparable requirements) on objects of type T , and both *this and x must be sorted according to that ordering. The slists x and *this must be distinct. (That is, it is required that &x != this .) This function removes all of x 's elements and inserts them in order into *this . The merge is stable; that is, if an element from *this is equivalent to one from x , then the element from *this will precede the one from x . All iterators to elements in *this and x remain valid. This function is linear time: it performs at most size() + x.size() – 1 applications of Comp .
void reverse(); Reverses the order of elements in the slist. All iterators remain valid and continue to point to the same elements. [6] This function is linear time.
void sort(); Sorts *this according to operator< . The sort is stable, that is, the relative order of equivalent elements is preserved. All iterators remain valid and continue to point to the same elements. [7] The number of comparisons is approximately N log N , where N is the slist 's size.
template void sort(BinaryPredicate comp);[5] Comp must be a comparison function that induces a strict weak ordering (as defined in the LessThan Comparable requirements) on objects of type T . This function sorts the slist *this according to Comp . The sort is stable, that is, the relative order of equivalent elements is preserved. All iterators remain valid and continue to point to the same elements. [7] The number of comparisons is approximately N log N , where N is the slist 's size.
Notes

[1] The lists in such languages as Common Lisp, Scheme, and ML are singly linked lists. In some programming languages, almost all data structures are represented as singly linked lists.

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

Интервал:

Закладка:

Сделать

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