KrisLibrary  1.0.0
Macros | Functions
utils.h File Reference

Utilities commonly used throughout a program. More...

#include <algorithm>

Go to the source code of this file.

Macros

#define SafeDelete(x)   { if (x) delete x; x=NULL; }
 Delete a non-NULL pointer and set it to NULL.
 
#define SafeArrayDelete(x)   { if (x) delete [] x; x=NULL; }
 Delete a non-NULL pointer to an array and set it to NULL.
 
#define SafeDeleteProc(x, proc)   { if (x) proc(x); x=NULL; }
 Delete a non-NULL pointer, using the provided function, and set it to NULL.
 
#define ArraySize(x)   (sizeof(x)/sizeof(x[0]))
 

Functions

template<class type >
type Max (const type &a, const type &b)
 
template<class type >
type Min (const type &a, const type &b)
 
template<class type >
void Swap (type &a, type &b)
 
template<class type >
type Max (const type &a, const type &b, const type &c)
 
template<class type >
type Max (const type &a, const type &b, const type &c, const type &d)
 
template<class type >
type Min (const type &a, const type &b, const type &c)
 
template<class type >
type Min (const type &a, const type &b, const type &c, const type &d)
 
void toggle (bool &bit)
 

Detailed Description

Utilities commonly used throughout a program.

Many of these are here just to provide a cross-platform interface to non-standard build environments (e.g. windows)