All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Functions
Enforce.h File Reference
#include <cassert>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Classes

struct  Aux::Checkers::Asserter
 Checks the bool via assert. More...
 
struct  Aux::Checkers::Enforcer
 Checks to bool via enforce. More...
 
struct  Aux::Checkers::Terminator
 Calls std::terminate if the bool is false. More...
 
struct  Aux::Checkers::Ignorer
 Won't look at the bool (not even in debug-mode, which is how this differs from Asserter) More...
 

Namespaces

 Aux
 
 Aux::Checkers
 This namespace provides some Types with a static member-function void enforce(bool) that may check wether the argument is true and create some kind of failure otherwise.
 

Functions

template<typename Exception = std::runtime_error>
void Aux::enforce (bool b, const char *msg="")
 Enforces that b is true and throws an Exception otherwise. More...
 
template<typename Exception = std::runtime_error>
void Aux::enforce (bool b, const std::string &msg)
 Overload that accepts a std::string. More...
 
template<typename Stream >
void Aux::enforceOpened (const Stream &stream)
 Checks that the provided fstream is opened and throws an exception otherwise. More...