std::swap
Déclaré dans l'en-tête <algorithm> Déclaré dans l'en-tête <utility> | (avant C++11) (depuis C++11) | |
template<class T > void swap( T& a, T& b ); | (1) | |
template<class T2, size_t N > void swap( T2 (&a)[N], T2 (&b)[N]); | (2) | (depuis C++11) |
Échange les valeurs données.
1) Échanges les valeurs a
et b
.
2) Echange les tableaux a
et b
. Pour cela, appelle std::swap_ranges(a, a+N, b).
Sommaire |
[modifier]Paramètres
a, b | - | les valeurs à permuter |
Type requirements | ||
-T must meet the requirements of MoveAssignable and MoveConstructible . | ||
-T2 must meet the requirements of Swappable . |
[modifier]Retourne la valeur
Aucune
[modifier]Exceptions
1)noexcept(noexcept( std::is_nothrow_move_constructible<T>::value&& | ||
[modifier]Complexité
1)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.
[modifier]Spécialisations
Il est autorisé à la fois de surcharger et de spécialiser l'algorithme std::swap, mais les surcharges sont généralement préférées car les spécialisations d'un modèle de fonction ne sont pas autorisées pour les classes template. Les fonctions de la bibliothèque standard utilisent toujours les surcharges fournies par l'utilisateur lors du swap, si elles sont reconnues lors de la recherche des argument (d'après le concept Swappable
).
Les surcharges suivantes sont déjà fournies par la bibliothèque standard :
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | permet de spécialiser l'algorithme std::swap (fonction générique) |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
spécialise l'algorithme std::swap() (fonction générique) | |
spécialise l'algorithme std::swap() (fonction générique) | |
spécialise l'algorithme std::swap() (fonction générique) | |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | l'algorithme spécialisé std::swap Original: specializes the std::swap algorithm The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
(C++11) | spécialise l'algorithme std::swap() (fonction générique) |
[modifier]Exemple
This section is incomplete Reason: no example |
[modifier]Voir aussi
permute les éléments pointés par deux itérateurs Original: swaps the elements pointed to by two iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |
swaps de deux gammes d'éléments Original: swaps two ranges of elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) |