boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
313 stars 74 forks source link

atomic_dense_storage? #313

Closed HDembinski closed 3 years ago

HDembinski commented 3 years ago

With https://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange one can atomically modify any object that is trivially copyable, meaning its bits fully represent its state and the states of two objects can be bit-compared. This is true for all the builtin accumulators right now. So we could make one storage that uses this to atomically write to its accumulators. This would make the thread_safe accumulator obsolete and we could suddenly use all accumulators in a thread-safe way.

HDembinski commented 3 years ago

Nevermind. It does not work, because we can still only use compare_exchange on arithmetic types.