• Пожаловаться

Standard Template Library Programmer's Guide

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

любовные романы фантастика и фэнтези приключения детективы и триллеры эротика документальные научные юмористические анекдоты о бизнесе проза детские сказки о религиии новинки православные старинные про компьютеры программирование на английском домоводство поэзия

Выбрав категорию по душе Вы сможете найти действительно стоящие книги и насладиться погружением в мир воображения, прочувствовать переживания героев или узнать для себя что-то новое, совершить внутреннее открытие. Подробная информация для ознакомления по текущему запросу представлена ниже:

libcat.ru: книга без обложки

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 — читать онлайн бесплатно полную книгу (весь текст) целиком

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

Тёмная тема

Шрифт:

Сбросить

Интервал:

Закладка:

Сделать

• Definition: a link to the source code where the function is defined.

• Requirements on types:most functions in the stl are function templates. This section lists the requirements that must be satisfied by the function's template parameters. Sometimes the requirements can simply be expressed by listing which concept a template parameter must conform to, but sometimes they are more complicated and involve a relationship between two different template parameters. In the case of find , for example, the requirements are that the parameter InputIterator is a model of Input Iterator, that the parameter EqualityComparable is a model of Equality Comparable, and that comparison for equality is possible between objects of type EqualityComparable and objects of InputIterator 's value types.

• Preconditions:functions usually aren't guaranteed to yield a well-defined result for any possible input, but only for valid input; it is an error to call a function with invalid input. This section describes the conditions for validity.

• Complexity:guarantees on the function's run-time complexity. For example, find 's run-time complexity is linear in the length of the input range.

• Example of use:a code fragment that illustrates how to use the function.

• Notes: footnotes (if any) that are referred to by other parts of the page.

• See Also: links to other related pages.

Containers

Concepts

General concepts

Container

Category: containers

Component type: concept

Description

A Container is an object that stores other objects (its elements ), and that has methods for accessing its elements. In particular, every type that is a model of Container has an associated iterator type that can be used to iterate through the Container's elements.

There is no guarantee that the elements of a Container are stored in any definite order; the order might, in fact, be different upon each iteration through the Container. Nor is there a guarantee that more than one iterator into a Container may be active at any one time. (Specific types of Containers, such as Forward Container, do provide such guarantees.)

A Container "owns" its elements: the lifetime of an element stored in a container cannot exceed that of the Container itself. [1]

Refinement of

Assignable

Associated types
Value typeX::value_typeThe type of the object stored in a container. The value type must be Assignable, but need not be DefaultConstructible. [2]
Iterator typeX::iteratorThe type of iterator used to iterate through a container's elements. The iterator's value type is expected to be the container's value type. A conversion from the iterator type to the const iterator type must exist. The iterator type must be an input iterator. [3]
Const iterator typeX::const_iteratorA type of iterator that may be used to examine, but not to modify, a container's elements. [3] [4]
Reference typeX::referenceA type that behaves as a reference to the container's value type. [5]
Const reference typeX::const_referenceA type that behaves as a const reference to the container's value type. [5]
Pointer typeX::pointerA type that behaves as a pointer to the container's value type. [6]
Distance typeX::difference_typeA signed integral type used to represent the distance between two of the container's iterators. This type must be the same as the iterator's distance type. [2]
Size typeX::size_typeAn unsigned integral type that can represent any nonnegative value of the container's distance type. [2]
Notation

XA type that is a model of Container

a, bObject of type X

TThe value type of X

Definitions

The size of a container is the number of elements it contains. The size is a nonnegative number.

The area of a container is the total number of bytes that it occupies. More specifically, it is the sum of the elements' areas plus whatever overhead is associated with the container itself. If a container's value type T is a simple type (as opposed to a container type), then the container's area is bounded above by a constant times the container's size times sizeof(T) . That is, if a is a container with a simple value type, then a 's area is O(a.size()) .

A variable sized container is one that provides methods for inserting and/or removing elements; its size may vary during a container's lifetime. A fixed size container is one where the size is constant throughout the container's lifetime. In some fixed-size container types, the size is determined at compile time.

Valid expressions

In addition to the expressions defined in Assignable, EqualityComparable, and LessThanComparable, the following expressions must be valid.

NameExpressionReturn type
Beginning of rangea.begin()iterator if a is mutable, const_iterator otherwise [4] [7]
End of rangea.end()iterator if a is mutable, const_iterator otherwise [4]
Sizea.size()size_type
Maximum sizea.max_size()size_type
Empty containera.empty()Convertible to bool
Swapa.swap(b)void
Expression semantics

Semantics of an expression is defined only where it differs from, or is not defined in, Assignable, Equality Comparable, or LessThan Comparable

NameExpressionSemanticsPostcondition
Copy constructorX(a)X().size() == a.size().X() contains a copy of each of a 's elements.
Copy constructorX b(a);b.size() == a.size().b contains a copy of each of a 's elements.
Assignment operatorb = ab.size() == a.size().b contains a copy of each of a 's elements.
Destructora.~X()Each of a 's elements is destroyed, and memory allocated for them (if any) is deallocated.
Beginning of rangea.begin()Returns an iterator pointing to the first element in the container. [7]a.begin() is either dereferenceable or past-the-end. It is past-the-end if and only if a.size() == 0.
End of rangea.end()Returns an iterator pointing one past the last element in the container.a.end() is past-the-end.
Sizea.size()Returns the size of the container, that is, its number of elements. [8]a.size() >= 0 && a.size() <= max_size()
Maximum sizea.max_size()Returns the largest size that this container can ever have. [8]a.max_size() >= 0 && a.max_size() >= a.size()
Empty containera.empty()Equivalent to a.size() == 0 . (But possibly faster.)
Swapa.swap(b)Equivalent to swap(a,b) [9]
Complexity guarantees

The copy constructor, the assignment operator, and the destructor are linear in the container's size.

Читать дальше
Тёмная тема

Шрифт:

Сбросить

Интервал:

Закладка:

Сделать

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

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


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

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