ITK  6.0.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 ( )
constexprdefault

Supports default construction

◆ Boolean() [2/2]

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

Supports implicit conversion from bool.

Definition at line 46 of file itkBoolean.h.

Member Function Documentation

◆ operator bool()

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

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
private

Definition at line 54 of file itkBoolean.h.

Referenced by operator bool().


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