Available C++ Libraries FAQ
Tools for C++ Programmers
Rich Booleans - A library to make powerful debugging libraries like ASSERT macrosThe Rich Booleans framework is a set of macros that hold extra information if the condition fails, so a developer understands what goes wrong. They allow modularization of assertions and other constructs that check conditions, so on the one hand we can have different types of assertion macros (ASSERT, VERIFY, ASSERT_MSG, ...), and on the other hand macros that replace booleans in the assertion macros to provide extra information. So one could write ASSERT(rbEQUAL(a,b)), VERIFY(rbLESS(foo(), 10)), etc. These Rich Booleans can even be reused in other situations, like a TASSERT macro in a unit testing framework, or in contracts. The macros just have to know how to handle a rich boolean.
A number of interesting rich booleans are in this library, like rbEQUAL_STRING that shows where two strings are different (taking care of mismatches and insertions in an intelligent way), and similar ones for ranges of iterators and STL containers. They can be combined to make powerful checks, like checking whether the integer values in one vector are smaller than those in another vector, comparing two vectors of vectors, or combining rich booleans with logical operations.
They are released under the Boost License, which allows free use in any code. It was tested with Visual C++ and Gnu C++, but contains no platform or compiler specific code, so it should be portable.
Added : 2005-02-11 Amended: 2005-02-11 Licensing : Non commercial
Copyright (c) 2018 Nikki Locke, Trumphurst Ltd.
Permission is granted to distribute over the Internet without charge. The author's permission is required (and usually given) to distribute in any other way, including on CD.