◐ Shell
clean mode source ↗

std::owner_less - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Definido no cabeçalho

<memory>

template< class T > struct owner_less; /* undefined */

(1) (desde C++11)

template< class T > struct owner_less<std::shared_ptr<T>>;

(2) (desde C++11)

template< class T > struct owner_less<std::weak_ptr<T>>;

(3) (desde C++11)

Este objeto função fornece proprietário com base em (em oposição ao valor de base) de tipo misto ordenação de ambos std::weak_ptr e std::shared_ptr. A ordem é tal que dois ponteiros inteligentes comparar equivalente só se forem ambos vazios ou se ambos gerenciar o mesmo objeto, mesmo se os valores dos ponteiros-primas obtidas por get() são diferentes (por exemplo, porque eles apontam subobjetos diferentes dentro de um mesmo 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.

Este modelo de classe é o predicado de comparação preferida quando a construção de contêineres associativos com std::shared_ptr ou std::weak_ptr como chaves, ou seja,

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.

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>>>.

O operator< padrão não está definido para ponteiros fracos, e pode considerar erroneamente dois ponteiros comuns para o mesmo objeto não-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.

Tipos de membro

Tipo de membro

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>

Funções de membro

compara seus argumentos usando proprietário baseados em 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.


(função)

Veja também

fornece-proprietário baseado ordenação dos ponteiros compartilhados

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.


(of std::shared_ptr função pública membro) [edit]