std::owner_less
De 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. |
| Defined in header <memory>
|
||
| template< class T > struct owner_less; /* undefined */ |
(1) | (ya que C + +11) |
| template< class T > struct owner_less<std::shared_ptr<T>>; |
(2) | (ya que C + +11) |
| template< class T > struct owner_less<std::weak_ptr<T>>; |
(3) | (ya que C + +11) |
Este objeto de función proporciona propietario basado en (a diferencia de valor) de tipo mixto ordenamiento de ambos std::weak_ptr y std::shared_ptr. El orden es tal que dos punteros inteligentes comparar equivalente sólo si están vacíos o si ambos administrar el mismo objeto, incluso si los valores de los punteros primas obtenidos por
get() son diferentes (por ejemplo, porque apuntan a diferentes subobjetos dentro del mismo objeto )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.
Esta plantilla de clase es el predicado de comparación preferida en la construcción de contenedores asociativos con std::shared_ptr o std::weak_ptr como claves, es decir,
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>>>.
El operator< defecto no está definida para los punteros débiles, y sin razón, pueden considerarse dos punteros compartidos para el mismo objeto no equivalente (ver 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.
[editar] Tipos de miembros
| Miembro de tipo
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> |
[editar] Las funciones miembro
| compara sus argumentos con base propietarios semántica 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. (función) | |
[editar] Ver también
| proporciona propietario basado pedido de punteros compartidos 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. (miembro público of std::shared_ptr función)
| |