std::owner_less
Aus 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. |
definiert in Header <memory>
|
||
template< class T > struct owner_less; /* undefined */ |
(1) | (seit C++11) |
template< class T > struct owner_less<std::shared_ptr<T>>; |
(2) | (seit C++11) |
template< class T > struct owner_less<std::weak_ptr<T>>; |
(3) | (seit C++11) |
Diese Funktion Objekt stellt Eigentümer-basierte Mixed-Typ Bestellbeispiel sowohl std::weak_ptr und std::shared_ptr (wie zur wertorientierten dagegen). Die Reihenfolge ist, so dass zwei Smartpointer gleichwertig nur wenn beide leer ist oder wenn sie beide das gleiche Objekt zu verwalten, selbst wenn die Werte der rohen Zeigern durch
get()
erhaltenen unterschiedlichen (zB sind, weil sie auf verschiedenen Unterobjekte innerhalb dasselbe Objekt sind, zu vergleichen )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.
Diese Klasse Vorlage ist die bevorzugte Vergleichsprädikat beim Bau assoziative Container mit std::shared_ptr oder std::weak_ptr als Schlüssel, das heißt,
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>>>.
Der Standardwert operator< kein schwacher Zeiger definiert und kann fälschlicherweise betrachten zwei geteilten Zeigern für dasselbe Objekt antivalenten (siehe 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.
[Bearbeiten] Mitglied Typen
Mitglied Typ
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> |
[Bearbeiten] Member-Funktionen
vergleicht ihre Argumente mit Besitzer-basierte Semantik 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. (Funktion) |
[Bearbeiten] Siehe auch
erlaubt Sortierung der shared_ptr basierend auf dem Besitz (öffentliche Elementfunktion of std::shared_ptr )
|