Thrill
0.1
|
This is a derivative of std::atomic which enables easier and less error-prone writing of move-only classes by implementing a move constructor.
std::atomic does not have a move constructor for a good reason: atomicity cannot be guaranteed. The problem is that then all move-only classes containing a std::atomic must implement custom move operations. However, in all our cases we only move objects during initialization. Custom move operations are trivial to write but error-prone to maintain, since they must contain all member variables. Missing variables create very subtle bugs, hence it is better to use this AtomicMovable class.
Definition at line 34 of file atomic_movable.hpp.
#include <atomic_movable.hpp>
Public Member Functions | |
AtomicMovable ()=default | |
default initialization (same as std::atomic) More... | |
constexpr | AtomicMovable (T desired) |
value initialization (same as std::atomic) More... | |
AtomicMovable (const AtomicMovable &rhs) noexcept | |
copy-construction (same as std::atomic) More... | |
AtomicMovable (const AtomicMovable &&rhs) noexcept | |
AtomicMovable & | operator= (const AtomicMovable &rhs) noexcept |
copy-assignment (same as std::atomic) More... | |
AtomicMovable & | operator= (AtomicMovable &&rhs) noexcept |
move-assignment NOT same as std::atomic: load and move. More... | |
T | operator= (T desired) noexcept |
assignment operator (same as std::atomic) More... | |
|
default |
default initialization (same as std::atomic)
|
inline |
value initialization (same as std::atomic)
Definition at line 41 of file atomic_movable.hpp.
|
inlinenoexcept |
copy-construction (same as std::atomic)
Definition at line 45 of file atomic_movable.hpp.
|
inlinenoexcept |
move-construction NOT same as std::atomic: load and move. Requires T to have an ctor that takes an instance of T for initialization.
Definition at line 51 of file atomic_movable.hpp.
|
inlinenoexcept |
copy-assignment (same as std::atomic)
Definition at line 55 of file atomic_movable.hpp.
|
inlinenoexcept |
move-assignment NOT same as std::atomic: load and move.
Definition at line 61 of file atomic_movable.hpp.
assignment operator (same as std::atomic)
Definition at line 67 of file atomic_movable.hpp.