cppreference.com
创建账户
登录
命名空间
页面
讨论
变体
视图
视图
编辑
历史
操作
std::packaged_task<R(Args...)>::
swap
来自 cppreference.com
<
cpp
|
thread
|
packaged task
C++
编译器支持
独立和托管
语言
标准库
标准库头文件
命名要求
功能测试宏
(C++20)
语言支持库
概念库
(C++20)
元编程库
(C++11)
诊断库
通用实用程序库
字符串库
容器库
迭代器库
范围库
(C++20)
算法库
数值库
本地化库
输入/输出库
文件系统库
(C++17)
正则表达式库
(C++11)
并发支持库
(C++11)
执行支持库
(C++26)
技术规范
符号索引
外部库
[编辑]
并发支持库
线程
thread
(C++11)
jthread
(C++20)
hardware_destructive_interference_size
hardware_constructive_interference_size
(C++17)
(C++17)
this_thread
命名空间
get_id
(C++11)
yield
(C++11)
sleep_for
(C++11)
sleep_until
(C++11)
协作取消
stop_token
(C++20)
inplace_stop_token
(C++26)
never_stop_token
(C++26)
stop_source
(C++20)
inplace_stop_source
(C++26)
stop_callback
(C++20)
inplace_stop_callback
(C++26)
stop_callback_for_t
(C++26)
stoppable_token
(C++26)
unstoppable_token
(C++26)
stoppable-source
(C++26)
stoppable-callback-for
(C++26)
互斥
mutex
(C++11)
recursive_mutex
(C++11)
shared_mutex
(C++17)
timed_mutex
(C++11)
recursive_timed_mutex
(C++11)
shared_timed_mutex
(C++14)
通用锁管理
lock
(C++11)
lock_guard
(C++11)
scoped_lock
(C++17)
unique_lock
(C++11)
shared_lock
(C++14)
once_flag
(C++11)
call_once
(C++11)
try_lock
(C++11)
defer_lock
try_to_lock
adopt_lock
defer_lock_t
try_to_lock_t
adopt_lock_t
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
条件变量
condition_variable
(C++11)
condition_variable_any
(C++11)
notify_all_at_thread_exit
(C++11)
cv_status
(C++11)
信号量
counting_semaphore
binary_semaphore
(C++20)
(C++20)
闩锁和屏障
latch
(C++20)
barrier
(C++20)
期货
promise
(C++11)
future
(C++11)
shared_future
(C++11)
packaged_task
(C++11)
async
(C++11)
launch
(C++11)
future_status
(C++11)
future_error
(C++11)
future_category
(C++11)
future_errc
(C++11)
安全回收
rcu_obj_base
(C++26)
rcu_domain
(C++26)
rcu_default_domain
(C++26)
rcu_synchronize
(C++26)
rcu_barrier
(C++26)
rcu_retire
(C++26)
危险指针
hazard_pointer_obj_base
(C++26)
hazard_pointer
(C++26)
make_hazard_pointer
(C++26)
原子类型
atomic
(C++11)
atomic_ref
(C++20)
atomic_flag
(C++11)
原子类型的初始化
atomic_init
(C++11)
(C++20 中已弃用)
ATOMIC_VAR_INIT
(C++11)
(C++20 中已弃用)
ATOMIC_FLAG_INIT
(C++11)
内存排序
memory_order
(C++11)
kill_dependency
(C++11)
atomic_thread_fence
(C++11)
atomic_signal_fence
(C++11)
原子操作的自由函数
atomic_store
atomic_store_explicit
(C++11)
(C++11)
atomic_load
atomic_load_explicit
(C++11)
(C++11)
atomic_exchange
atomic_exchange_explicit
(C++11)
(C++11)
atomic_compare_exchange_weak
atomic_compare_exchange_weak_explicit
atomic_compare_exchange_strong
atomic_compare_exchange_strong_explicit
(C++11)
(C++11)
(C++11)
(C++11)
atomic_fetch_add
atomic_fetch_add_explicit
(C++11)
(C++11)
atomic_fetch_sub
atomic_fetch_sub_explicit
(C++11)
(C++11)
atomic_fetch_and
atomic_fetch_and_explicit
(C++11)
(C++11)
atomic_fetch_or
atomic_fetch_or_explicit
(C++11)
(C++11)
atomic_fetch_xor
atomic_fetch_xor_explicit
(C++11)
(C++11)
atomic_fetch_max
atomic_fetch_max_explicit
(C++26)
(C++26)
atomic_fetch_min
atomic_fetch_min_explicit
(C++26)
(C++26)
atomic_is_lock_free
(C++11)
atomic_wait
atomic_wait_explicit
(C++20)
(C++20)
atomic_notify_one
(C++20)
atomic_notify_all
(C++20)
原子标志的自由函数
atomic_flag_test_and_set
atomic_flag_test_and_set_explicit
(C++11)
(C++11)
atomic_flag_clear
atomic_flag_clear_explicit
(C++11)
(C++11)
atomic_flag_test
atomic_flag_test_explicit
(C++20)
(C++20)
atomic_flag_wait
atomic_flag_wait_explicit
(C++20)
(C++20)
atomic_flag_notify_one
(C++20)
atomic_flag_notify_all
(C++20)
[编辑]
std::packaged_task
成员函数
packaged_task::packaged_task
packaged_task::~packaged_task
packaged_task::operator=
packaged_task::valid
packaged_task::swap
获取结果
packaged_task::get_future
执行
packaged_task::operator()
packaged_task::make_ready_at_thread_exit
packaged_task::reset
非成员函数
swap
(std::packaged_task)
辅助类
uses_allocator
<std::packaged_task>
(直到 C++17)
推导指南
(C++17)
[编辑]
void
swap
(
packaged_task
&
other
)
noexcept
;
(自 C++11)
交换
*
this
和
other
的共享状态和存储的任务。
[
编辑
]
参数
other
-
要与其交换状态的打包任务
[
编辑
]
返回值
(无)
[
编辑
]
另请参见
std::swap
(std::packaged_task)
(C++11)
专门化了
std::swap
算法
(函数模板)
[编辑]