std::swap
提供: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 <algorithm>
Defined in header <utility> |
(C + + 11時まで) (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) | (C + + 11以来) |
交流与えられた値.
1) Original:
Exchanges the given values.
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.
スワップ値
2) a
とb
.Original:
Swaps the values
a
and b
.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.
スワップアレイ
a
とb
。要するにstd::swap_ranges(a, a+N, b)呼び出し.Original:
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.
目次 |
[編集] パラメータ
a, b | - | 値がスワップされます
Original: the values to be swapped The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Type requirements | ||
-T must meet the requirements of MoveAssignable and MoveConstructible .
| ||
-T2 must meet the requirements of Swappable .
|
[編集] 値を返します
(なし)
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.
[編集] 例外
1)noexcept specification: (C + + 11以来)
2)
noexcept(noexcept( std::is_nothrow_move_constructible<T>::value && |
||
[編集] 複雑
1)定数
2) Original:
Constant
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.
N
Original:
Linear in N
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::swapアルゴリズムの両方で、カスタムの専門化とオーバーロードは許可されますが、関数テンプレートの特殊化、テンプレートクラスに対して許可されていませんので、オーバーロードが一般的に好ましい。それらは引数依存ルックアップ(
Swappable
コンセプトごとなど)によって発見された場合、スワップするときは、ライブラリ関数は、常にユーザーが提供するオーバーロードを使用して.Original:
Both custom specializations and overloads of the std::swap algorithm are allowed, but the overloads are generally preferred since specializations of a function template aren't allowed for template classes. Library functions always use the user-provided overloads when swapping, if they are found by argument-dependent lookup (as per
Swappable
concept).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.
次のオーバーロードは、すでに標準ライブラリで提供されています
Original:
The following overloads are already provided by the standard library:
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.
(C++11) |
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. (関数テンプレート) |
(C++11) |
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. (関数テンプレート) |
(C++11) |
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. (関数テンプレート) |
(C++11) |
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. (関数テンプレート) |
(C++11) |
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. (関数テンプレート) |
(C++11) |
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. (関数テンプレート) |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
(C++11) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
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. (関数テンプレート) | |
(C++11) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) | |
(C++11) |
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. (関数テンプレート) |
(C++11) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) |
(C++11) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) |
std::swap() アルゴリズムを専門としていますOriginal: specializes the std::swap() algorithmThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数テンプレート) |
[編集] 例
This section is incomplete Reason: no example |
[編集] も参照してください
スワップ二つのイテレータが指す要素 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. (関数テンプレート) | |
スワップの要素の2つの範囲を 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. (関数テンプレート) |