BDE 4.14.0 Production release
|
Provide the most awkward type that is convertible to bool
.
bool
This component provides a type that is convertible-to-bool
, and so may be used to satisfy many C++ standard library requirements, but is perversely implemented to provide the most awkward interface that meets the requirements. This type is not intended for use in production code, but is most useful when implementing test drivers for generic components that must accept predicates, or other expressions, that yield a type that is merely convertible to bool
.
This section illustrates intended use of this component.
The following snippets of code provide a simple illustration of using bsltf::EvilBooleanType
.
First, we create an object trueValue
and initialize it with the true
value:
Now, we can use it for if-else conditions or another constructions, that require boolen value:
Finally we create another object, having the opposite value, and verify it: