std::list::unique
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
void unique(); | (1) | |
template<class BinaryPredicate > void unique( BinaryPredicate p ); | (2) | |
Rimuove tutti gli elementi duplicati consecutivi' dal contenitore. Solo il primo elemento in ciascun gruppo di elementi uguali viene lasciato. La prima versione utilizza
operator==
di confrontare gli elementi, la seconda versione utilizza il predicato binario dato p
.Original:
Removes all consecutive duplicate elements from the container. Only the first element in each group of equal elements is left. The first version uses
operator==
to compare the elements, the second version uses the given binary predicate p
.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.
Indice |
[modifica]Parametri
p | - | binary predicate which returns true if the elements should be treated as equal. The signature of the predicate function should be equivalent to the following: bool pred(const Type1 &a, const Type2 &b); The signature does not need to have const&, but the function must not modify the objects passed to it. |
[modifica]Valore di ritorno
(Nessuno)
Original:
(none)
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.
[modifica]Complessità
Lineare nella dimensione del contenitore
Original:
Linear in the size of the container
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.
[modifica]Esempio
Output:
contents before: 1 2 2 3 3 2 1 1 2 contents after unique(): 1 2 3 2 1 2
[modifica]Vedi anche
removes consecutive duplicate elements in a range (funzione di modello) |