- thread[meta header]
- std[meta namespace]
- jthread[meta class]
- function[meta id-type]
- cpp20[meta cpp]
void swap(jthread& x) noexcept;別のjthreadと交換する。
*thisとxを入れ替える。
送出しない。
#include <thread>
int main()
{
std::jthread t1([]{ /*...*/ });
std::jthread t2;
t1.swap(t2);
t2.join();
return 0;
}- swap[color ff0000]
- join[link join.md]
- C++20
- Clang:
- GCC: 10.2.0
- Visual C++: ??