Bool storage shared with Matter.
More...
#include <ParametersOptions.h>
|
| std::shared_ptr< bool > | bit {std::make_shared<bool>(false)} |
|
| std::shared_ptr< bool > & | ensure () |
Bool storage shared with Matter.
Assignment updates the same cell, so a Matter built from this Parameters sees a later write. Copying the flag makes a new cell. Destroying the Parameters leaves the cell with its last value for any Matter that still holds it. The cell is not the Parameters address, so a new Parameters allocated in the same place does not alias an older Matter.
Definition at line 31 of file ParametersOptions.h.
◆ shared_flag() [1/4]
| eonc::shared_flag::shared_flag |
( |
| ) |
|
|
default |
◆ shared_flag() [2/4]
| eonc::shared_flag::shared_flag |
( |
bool | value | ) |
|
|
inlineexplicit |
Definition at line 35 of file ParametersOptions.h.
35:
bit(std::make_shared<bool>(value)) {}
std::shared_ptr< bool > bit
◆ shared_flag() [3/4]
| eonc::shared_flag::shared_flag |
( |
const shared_flag & | other | ) |
|
|
inline |
◆ shared_flag() [4/4]
| eonc::shared_flag::shared_flag |
( |
shared_flag && | other | ) |
|
|
inlinenoexcept |
◆ ensure()
| std::shared_ptr< bool > & eonc::shared_flag::ensure |
( |
| ) |
|
|
inlineprivate |
◆ operator bool()
| eonc::shared_flag::operator bool |
( |
| ) |
const |
|
inline |
◆ operator=() [1/3]
| shared_flag & eonc::shared_flag::operator= |
( |
bool | value | ) |
|
|
inline |
Definition at line 56 of file ParametersOptions.h.
56 {
58 return *this;
59 }
std::shared_ptr< bool > & ensure()
◆ operator=() [2/3]
Definition at line 40 of file ParametersOptions.h.
40 {
41 if (this != &other) {
42 *
ensure() =
static_cast<bool>(other);
43 }
44 return *this;
45 }
◆ operator=() [3/3]
Definition at line 46 of file ParametersOptions.h.
46 {
47 if (this != &other) {
48 if (
bit && other.bit) {
50 } else {
51 bit = std::move(other.bit);
52 }
53 }
54 return *this;
55 }
◆ share()
| std::shared_ptr< bool > eonc::shared_flag::share |
( |
| ) |
const |
|
inlinenodiscard |
◆ bit
| std::shared_ptr<bool> eonc::shared_flag::bit {std::make_shared<bool>(false)} |
The documentation for this struct was generated from the following file: