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

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

Интервал:

Закладка:

Сделать

xAn object of type X

Valid expressions
Name Expression Return type
Default constructor X() X
Default constructor X x;[1]
Expression semantics
Name Expression
Default constructor X()
Default constructor X x;
Models

• int

• vector

Notes

[1] The form X x = X() is not guaranteed to be a valid expression, because it uses a copy constructor. A type that is DefaultConstructible is not necessarily Assignable

See also

Assignable

Equality Comparable

Category: utilities

Component type: concept

Description

A type is EqualityComparable if objects of that type can be compared for equality using operator== , and if operator== is an equivalence relation.

Notation

XA type that is a model of EqualityComparable

x, y, zObject of type X

Valid expressions
Name Expression Return type
Equality x == y Convertible to bool
Inequality x != y Convertible to bool
Expression semantics
Name Expression Precondition Semantics
Equality x == y x and y are in the domain of ==
Inequality x != y x and y are in the domain of == Equivalent to !(x == y)
Invariants
Identity &x == &y implies x == y
Reflexivity x == x
Symmetry x == y implies y == x
Transitivity x == y and y == z implies x == z
Models

• int

• vector

See also

LessThanComparable.

LessThan Comparable

Category: utilities

Component type: concept

Description

A type is LessThanComparable if it is ordered: it must be possible to compare two objects of that type using operator< , and operator< must be a partial ordering.

Notation

XA type that is a model of LessThanComparable

x, y, zObject of type X

Definitions

Consider the relation !(x < y) && !(y < x) . If this relation is transitive (that is, if !(x < y) && !(y < x) && !(y < z) && !(z < y) implies !(x < z) && !(z < x) ), then it satisfies the mathematical definition of an equivalence relation. In this case, operator< is a strict weak ordering .

If operator< is a strict weak ordering, and if each equivalence class has only a single element, then operator< is a total ordering .

Valid expressions
Name Expression Return type
Less x < y Convertible to bool
Greater x > y Convertible to bool
Less or equal x <= y Convertible to bool
Greater or equal x >= y Convertible to bool
Expression semantics
Name Expression Precondition Semantics
Less x < y x and y are in the domain of <
Greater x > y x and y are in the domain of < Equivalent to y < x [1]
Less or equal x <= y x and y are in the domain of < Equivalent to !(y < x) [1]
Greater or equal x >= y x and y are in the domain of < Equivalent to !(x < y) [1]
Invariants
Irreflexivity x < x must be false.
Antisymmetry x < y implies !(y < x) [2]
Transitivity x < y and y < z implies x < z [3]
Models

• int

Notes

[1] Only operator< is fundamental; the other inequality operators are essentially syntactic sugar.

[2] Antisymmetry is a theorem, not an axiom: it follows from irreflexivity and transitivity.

[3] Because of irreflexivity and transitivity, operator< always satisfies the definition of a partial ordering . The definition of a strict weak ordering is stricter, and the definition of a total ordering is stricter still.

See also

EqualityComparable, StrictWeakOrdering

Functions

Relational Operators

Category: utilities

Component type: function

Prototype

template

bool operator!=(const T& x, const T& y);

template

bool operator>(const T& x, const T& y);

template

bool operator<=(const T& x, const T& y);

template

bool operator>=(const T& x, const T& y);

Description

The Equality Comparable requirements specify that it must be possible to compare objects using operator!= as well as operator== ; similarly, the LessThan Comparable requirements include operator> , operator<= and operator>= as well as operator< . Logically, however, most of these operators are redundant: all of them can be defined in terms of operator== and operator< .

These four templates use operator== and operator< to define the other four relational operators. They exist purely for the sake of convenience: they make it possible to write algorithms in terms of the operators != , > , <= , and >= , without requiring that those operators be explicitly defined for every type.

As specified in the Equality Comparable requirements, x != y is equivalent to !(x == y) . As specified in the LessThan Comparable requirements, x > y is equivalent to y < x , x >= y is equivalent to !(x < y) , and x <= y is equivalent to !(y < x) .

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

Интервал:

Закладка:

Сделать

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