Documentation of CSL
Public Member Functions | Data Fields | Friends
csl::InitSanitizer< T > Class Template Reference

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)
 
InitSanitizeroperator= (T const &t)
 
 operator T () const
 
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)
 

Detailed Description

template<typename T>
class csl::InitSanitizer< T >

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.

Template Parameters
TType of the encapsulated object.

The documentation for this class was generated from the following file: