if(!x.compare_exchange_strong(0,10)){constautocurrent_x=x;// x.load()// ...} compare_ex...
(1)(since C++11) boolcompare_exchange_weak(T&expected, T desired, std::memory_ordersuccess, std::memory_orderfailure)volatilenoexcept; (2)(since C++11) boolcompare_exchange_weak(T&expected, T desired, std::memory_orderorder= std::memory_order_seq_cst)noexcept; ...