| cppx-core
    | 
A drop-in replacement for bool without implicit conversion from/to types other than bool.  
 More...
#include <Truth.hpp>
| Public Member Functions | |
| template<class Result , class = Enable_if_<is_bool_<Result>>> | |
| constexpr | operator Result () const noexcept | 
| Implicit conversion to bool(only).  More... | |
| template<class Arg , class = Enable_if_<is_bool_<Arg>>> | |
| constexpr | Truth (const Arg value) noexcept | 
| Construction from bool(only).  More... | |
A drop-in replacement for bool without implicit conversion from/to types other than bool. 
Implicit conversions to and from bool type are a common cause of undesired overload resolution. Truth only converts implicitly to and from bool. It's mostly a drop-in replacement for bool because you can use Truth values directly as conditions in if and loop statements, and in boolean operator expressions.
“Mostly”: as of C++17 Truth, like any other user-defined class type, can't be used as template value parameter type, but this may change with C++20.
Unplanned positive effect: indexing of a std::vector<Truth> produces a reference to a Truth item, which you can take the address of, rather than the proxy object that you usually get with a std::vector<bool>. The proxy objects of the latter allows it to store just 1 bit per item, at a cost that includes marginally reduced efficiency and high inconvenience. That cost is avoided with Truth as item type. 
| 
 | inlinenoexcept | 
| 
 | inlinenoexcept | 
 1.8.15
 1.8.15