std::atomic::exchange
STD::原子::交换
| | (since C++11) |
---|---|---|
T exchange( T desired, std::memory_order order = std::memory_order_seq_cst | | |
T exchange( T desired, std::memory_order order = std::memory_order_seq_cst ) volatile; | | |
原子化地将基础值替换为desired
.操作是读-修改-写操作.。的值影响内存。order
...
参数
desired | - | value to assign |
---|---|---|
order | - | memory order constraints to enforce |
返回值
调用前原子变量的值。
例外
noexcept
规格:
noexcept
另见
atomic_exchangeatomic_exchange_explicit (C++11)(C++11) | atomically replaces the value of the atomic object with non-atomic argument and returns the old value of the atomic (function template) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。