named_bool Struct
Struct representing a named boolean constant, created by the _b literal. More...
Declaration
Included Headers
Base struct
| struct | op |
|
Empty base struct for the framework expression types. More... | |
Public Member Typedefs Index
| using | op_type = op |
|
Marker identifying the framework expression types. More... | |
| using | value_type = bool |
|
The type of the value. More... | |
Public Constructors Index
| constexpr | named_bool (std::string_view name) noexcept |
|
Constructs a named boolean constant with the given name. More... | |
Public Operators Index
| constexpr | operator value_type () const noexcept |
|
Conversion operator to bool. More... | |
Public Member Functions Index
| constexpr std::string_view | name (void) const noexcept |
|
Returns the name of the constant. More... | |
Private Member Attributes Index
| std::string_view | name_ |
|
The name of the constant. More... | |
Description
Struct representing a named boolean constant, created by the _b literal.
The named_bool struct holds the constant true, together with a name, which the expression formatter prints instead of the value, so that a failed comparison like "flag"_b == flag, with the operators in the operators namespace, is reported as flag == false.
The value is available only via the implicit conversion to bool, and the struct has neither a get() accessor nor comparison operators. Thus detail::unwrap() returns the object itself, so that the formatter receives the name, the comparators compare it as the bool value true, and the generic operators in the operators namespace, not a better matching operator of this struct, are selected for it.
The name is not owned; it refers to the string literal, which has static storage duration.
Definition at line 743 of file deprecated.h.
Public Member Typedefs
op_type
|
Marker identifying the framework expression types.
Detected by the extension::is_op concept, and inherited by all types derived from op.
Definition at line 128 of file extension.h.
value_type
|
The type of the value.
The named literal behaves as a boolean value.
Definition at line 751 of file deprecated.h.
Public Constructors
named_bool()
| explicit constexpr noexcept |
Constructs a named boolean constant with the given name.
- Parameters
-
name The name, printed in place of the value.
Stores the view of the name; the characters are not copied.
Declaration at line 758 of file deprecated.h, definition at line 647 of file deprecated-inlines.h.
Public Operators
operator value_type()
| nodiscard constexpr noexcept |
Conversion operator to bool.
- Parameters
None.
- Returns
true.
Always returns true, the value of all named boolean constants.
Declaration at line 768 of file deprecated.h, definition at line 657 of file deprecated-inlines.h.
Public Member Functions
name()
| nodiscard constexpr noexcept |
Returns the name of the constant.
- Parameters
None.
- Returns
The name passed to the constructor.
Returns the stored view of the name.
Declaration at line 778 of file deprecated.h, definition at line 667 of file deprecated-inlines.h.
Reference name_.
Referenced by named_bool and micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<.
Private Member Attributes
name_
|
The name of the constant.
Not owned; refers to the characters of the string literal.
Definition at line 787 of file deprecated.h.
Referenced by named_bool and name.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.