std::owner_less
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <memory>
|
||
| template< class T > struct owner_less; /* undefined */ |
(1) | (начиная с C++11) |
| template< class T > struct owner_less<std::shared_ptr<T>>; |
(2) | (начиная с C++11) |
| template< class T > struct owner_less<std::weak_ptr<T>>; |
(3) | (начиная с C++11) |
Эта функция предоставляет владельцу объекта на основе (в отличие от значения основе) смешанного типа упорядочения и std::weak_ptr и std::shared_ptr. Порядок таков, что два умных указателей сравнить эквивалентную только тогда, когда оба они пустые или если они оба управление и тот же объект, даже если значения сырые указатели получены
get() различны (например, потому что они указывают на различных подобъектов в пределах одного объекта )Original:
This function object provides owner-based (as opposed to value-based) mixed-type ordering of both std::weak_ptr and std::shared_ptr. The order is such that two smart pointers compare equivalent only if they are both empty or if they both manage the same object, even if the values of the raw pointers obtained by
get() are different (e.g. because they point at different subobjects within the same object)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Этот шаблон класса является предпочтительным предикат сравнения при построении ассоциативных контейнеров с std::shared_ptr или std::weak_ptr в качестве ключей, то есть
Original:
This class template is the preferred comparison predicate when building associative containers with std::shared_ptr or std::weak_ptr as keys, that is,
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
std::map<std::shared_ptr<T>, U, std::owner_less<std::shared_ptr<T>>>
or
std::map<std::weak_ptr<T>, U, std::owner_less<std::weak_ptr<T>>>.
По умолчанию operator< не определено для слабых указателей, и, возможно, ошибочно рассматривать два общих указателей на тот же объект не эквивалентны (см. shared_ptr::owner_before)
Original:
The default operator< is not defined for weak pointers, and may wrongly consider two shared pointers for the same object non-equivalent (see shared_ptr::owner_before)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Член типов
| Член типа
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
result_type
|
bool |
first_argument_type
|
1) T 2) std::shared_ptr<T> 3) std::weak_ptr<T> |
second_argument_type
|
1) T 2) std::shared_ptr<T> 3) std::weak_ptr<T> |
[править] Член функций
| сравнивает свои аргументы, используя владелец основе семантики Original: compares its arguments using owner-based semantics The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (функция) | |
[править] См. также
| предоставляет владельцу на основе упорядочения общих указателей Original: provides owner-based ordering of shared pointers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член std::shared_ptr)
| |