ITK  5.4.0
Insight Toolkit
Public Member Functions | Private Attributes | List of all members
itk::Boolean Class Reference

#include <itkBoolean.h>

Detailed Description

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

Constructor & Destructor Documentation

◆ Boolean() [1/2]

constexpr itk::Boolean::Boolean ( )

Supports default construction

◆ Boolean() [2/2]

constexpr itk::Boolean::Boolean ( bool  v)

Supports implicit conversion from bool.

Definition at line 46 of file itkBoolean.h.

Member Function Documentation

◆ operator bool()

constexpr itk::Boolean::operator bool ( ) const

Supports implicit conversion to bool.

Definition at line 51 of file itkBoolean.h.

References m_Value.

Member Data Documentation

◆ m_Value

bool itk::Boolean::m_Value = false

Definition at line 54 of file itkBoolean.h.

Referenced by operator bool().

The documentation for this class was generated from the following file: