micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::detail::ambiguous_condition Concept Reference

Concept satisfied by the wrappers of a bool, whose condition is ambiguous. More...

#include <extension.h>

Concept definition

template<class T>
Concept satisfied by the wrappers of a bool, whose condition is ambiguous.
Definition extension.h:216
Trait marking the wrappers of a bool, whose condition is ambiguous.
Definition extension.h:146
Struct template representing a generic value, accessible via a getter.
Definition deprecated.h:629

Detailed Description

The condition of a std::optional<bool>, or of a smart pointer to a bool, tests the wrapper (a value is present, or the pointer is not null), not the bool that it holds, which is what a reader of t.expect (flag) assumes; a check with false inside would pass, and be reported as true, for another reason than the one the author had in mind, as the checks of the arguments that are always true (see suspicious_condition). A check that passes silently by mistake is worse than one that does not compile, so extension::checkable rejects these types, and the application writes has_value(), != nullptr, or compares the value with eq(). The wrappers of the other types are accepted, since the presence of a value is then the only meaning of the condition.

Template Parameters
TThe type to check.

Definition at line 216 of file extension.h.