ITK
6.0.0
Insight Toolkit
|
#include <itkBoolean.h>
An alternative to bool for additional thread safety.
The class Boolean
provides an alternative to bool
. std::vector<bool>
is not thread safe due to the possibility of multiple bits being packed together in the same memory location. std::vector<Boolean> does not have such a space optimization. std::vector<Boolean> is semantically like std::vector<bool>
, but unlike std::vector<bool>
, it does "avoid data races when the contents of the contained object in different elements in the same container [...] are
modified concurrently", according to the C++ Standard, section [container.requirements.dataraces], "Container data
races".
Definition at line 38 of file itkBoolean.h.
Public Member Functions | |
constexpr | Boolean ()=default |
constexpr | Boolean (bool v) |
constexpr | operator bool () const |
Private Attributes | |
bool | m_Value = false |
|
constexprdefault |
Supports default construction
|
inlineconstexpr |
Supports implicit conversion from bool
.
Definition at line 46 of file itkBoolean.h.
|
inlineconstexpr |
Supports implicit conversion to bool
.
Definition at line 51 of file itkBoolean.h.
References m_Value.
|
private |
Definition at line 54 of file itkBoolean.h.
Referenced by operator bool().