#include <safe_bool.h>
Public Types | |
typedef void(safe_bool_base::* | bool_type) () const |
Public Member Functions | |
void | this_type_does_not_support_comparisons () const |
Protected Member Functions | |
safe_bool_base () | |
safe_bool_base (const safe_bool_base &) | |
safe_bool_base & | operator= (const safe_bool_base &) |
~safe_bool_base () | |
This is a helper class which can be used to make pre-C++11 operator bool() comparisons safer by making them behave a bit more like they have the "explicit" keyword attached. The idea is to define your class using the CRTP idiom and implement the non-virtual boolean_test() function, e.g.:
class Foo : public safe_bool<Foo> { public: bool boolean_test() const { // Perform actual logic here to determine true/false return value. return false; } };
The idea is from: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool
Definition at line 44 of file safe_bool.h.
typedef void(safe_bool_base::* libMesh::safe_bool_base::bool_type) () const |
Definition at line 47 of file safe_bool.h.
|
inlineprotected |
Definition at line 51 of file safe_bool.h.
|
inlineprotected |
Definition at line 52 of file safe_bool.h.
|
inlineprotected |
Definition at line 54 of file safe_bool.h.
|
inlineprotected |
Definition at line 53 of file safe_bool.h.
|
inline |
Definition at line 48 of file safe_bool.h.
Referenced by libMesh::safe_bool< AutoPtr< Tp > >::operator bool_type(), libMesh::operator!=(), and libMesh::operator==().