C++11

// <atomic> 
// 类模板(1)    
template <class T>
    bool atomic_compare_exchange_weak_explicit
        (volatile atomic<T>* obj,T* expected, T val,
        memory_order success, memory_order failure) noexcept;
template <class T>
    bool atomic_compare_exchange_weak_explicit
        (atomic<T>* obj,T* expected, T val,
        memory_order success, memory_order failure) noexcept;
// 重载(2)    
bool atomic_compare_exchange_weak_explicit
    (volatile A* obj,T* expected, T val,
    memory_order success, memory_order failure) noexcept;
bool atomic_compare_exchange_weak_explicit
    (A* obj,T* expected, T val,
    memory_order success, memory_order failure) noexcept;

原子比较(Atomically compare)一个原子对象的值与一个非原子参数,如果相等则进行原子交换(Atomic exchange),否则进行原子加载(Atomic load)