Skip to main content

named_bool Struct

Struct representing a named boolean constant, created by the _b literal. More...

Declaration​

struct micro_os_plus::micro_test_plus::detail::named_bool { ... }

Included Headers​

Base struct​

structop

Empty base struct for the framework expression types. More...

Public Member Typedefs Index​

usingop_type = op

Marker identifying the framework expression types. More...

usingvalue_type = bool

The type of the value. More...

Public Constructors Index​

constexprnamed_bool (std::string_view name) noexcept

Constructs a named boolean constant with the given name. More...

Public Operators Index​

constexproperator value_type () const noexcept

Conversion operator to bool. More...

Public Member Functions Index​

constexpr std::string_viewname (void) const noexcept

Returns the name of the constant. More...

Private Member Attributes Index​

std::string_viewname_

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​

using micro_os_plus::micro_test_plus::detail::op::op_type = op

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.

128 using op_type = op;

value_type​

using micro_os_plus::micro_test_plus::detail::named_bool::value_type = bool

The type of the value.

The named literal behaves as a boolean value.

Definition at line 751 of file deprecated.h.

751 using value_type = bool;

Public Constructors​

named_bool()​

micro_os_plus::micro_test_plus::detail::named_bool::named_bool (std::string_view name)
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.

647 constexpr named_bool::named_bool (std::string_view name) noexcept
648 : name_{ name }
649 {
650 }

References name and name_.

Public Operators​

operator value_type()​

micro_os_plus::micro_test_plus::detail::named_bool::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.

657 operator value_type () const noexcept
658 {
659 return true;
660 }

Public Member Functions​

name()​

std::string_view micro_os_plus::micro_test_plus::detail::named_bool::name (void)
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.

667 named_bool::name (void) const noexcept
668 {
669 return name_;
670 }

Reference name_.

Referenced by named_bool and micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<.

Private Member Attributes​

name_​

std::string_view micro_os_plus::micro_test_plus::detail::named_bool::name_

The name of the constant.

Not owned; refers to the characters of the string literal.

Definition at line 787 of file deprecated.h.

787 std::string_view name_;

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.