diff options
author | Sven Gothel <[email protected]> | 2021-11-17 03:41:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-11-17 03:41:36 +0100 |
commit | 5356253cf09d60a539042b3210c2d3602fda7e0e (patch) | |
tree | 28ff84e34f2541c73bc0de59d5e55d52c0132d1e /include/jau | |
parent | 13f8847311463170e482d77ea61c12376214b5d7 (diff) |
ordered_atomic: Add to_string(const ordered_atomic<>&), allowing to skip manual '.load()' using jau::to_string() etc.
Diffstat (limited to 'include/jau')
-rw-r--r-- | include/jau/ordered_atomic.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/jau/ordered_atomic.hpp b/include/jau/ordered_atomic.hpp index 8b855be..0193cc3 100644 --- a/include/jau/ordered_atomic.hpp +++ b/include/jau/ordered_atomic.hpp @@ -209,6 +209,12 @@ template <typename _Tp, std::memory_order _MO> struct ordered_atomic : private s }; + template <typename _Tp, std::memory_order _MO> + std::string to_string(const ordered_atomic<_Tp, _MO> & ref) + { + return to_string(ref.load()); + } + /** SC atomic integral scalar boolean. Memory-Model (MM) guaranteed sequential consistency (SC) between acquire (read) and release (write) */ typedef ordered_atomic<bool, std::memory_order::memory_order_seq_cst> sc_atomic_bool; |