Hello !
I am a SE and I program based on boost library, I have one question to ask as below:
When I use the atomic library included boost , I coded as following:
atomic<bool> flag; //declare the var
flag.store(true,boost::memory_order_acq_rel); // use store method to change the value of flag
but BOOST_ASSERT failed,and I read the code of base_atomic<> template class,I found the the store() method can not support several memory_orders metioned in the subject , and the other methods can not support all memory_orders,such as:
1.the load method can not support memory_order_release and memory_order_acq_rel
2. the compare_exchange_strong method can not support memory_order_release and memory_order_acq_rel
3. the compare_exchange_weak method can not support memory_order_release and memory_order_acq_rel
I really want to know the reason that why the methods of atomic can not support all memory_orders.
If I need the methods of the atomic<> support all memory_orders,how can i do?
thank you very much!