How can I create an atomic enum in C++?

前端 未结 2 1821
忘了有多久
忘了有多久 2021-01-03 20:50

Class atomic contains atomic versions of many different variable types. However, it doesn\'t contain an atomic enum type. Is there a way to use atomic enums or

2条回答
  •  悲&欢浪女
    2021-01-03 21:50

    The generic atomic template can be used for all trivially copyable types, including enumerations. Whether or not it's lock-free is up to the implementation; hopefully it will be, if the underlying integer type is.

提交回复
热议问题