Encapsulates a value of a given to ensure that it initialized when used. More...
#include <initSanitizer.h>
Public Member Functions | |
| constexpr | InitSanitizer (char const t_name[]) |
| InitSanitizer (T const &t) | |
| InitSanitizer & | operator= (T const &t) |
| operator T () const | |
| T | get () const |
| void | reset () |
| void | print (std::ostream &out=std::cout) const |
Data Fields | |
| char const * | name |
Friends | |
| std::ostream & | operator<< (std::ostream &out, InitSanitizer const &san) |
Encapsulates a value of a given to ensure that it initialized when used.
An object of type InitSanitizer<T> can be used as a number for assignment and will be automatically converted to the encapsulated value when necessary. When assigned, the value becomes safe (initially not). When the encapsulated value is taken from the object, it checks that it is indeed initialized before returning it to ensure that there is no garbage result.
| T | Type of the encapsulated object. |
1.8.13