- thread[meta header]
- std[meta namespace]
- jthread[meta class]
- function[meta id-type]
- cpp20[meta cpp]
friend void swap(jthread& x, jthread& y) noexcept;2つのjthreadオブジェクトを入れ替える
x.swap(y);- swap[link swap.md]
なし
投げない
#include <thread>
int main()
{
std::jthread t1([]{ /*...*/ });
std::jthread t2;
swap(t1, t2);
t2.join();
return 0;
}- swap[color ff0000]
- C++20
- Clang:
- GCC: 10.2.0
- Visual C++: ??