UCommon
Data Structures | Namespaces | Macros | Functions
generics.h File Reference

Generic templates for C++. More...

#include <ucommon/cpr.h>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
Include dependency graph for generics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  ucommon::array_pointer< T >
 Generic smart array class. More...
 
class  ucommon::pointer< T >
 Generic smart pointer class. More...
 
class  ucommon::save_restore< T >
 Save and restore global objects in function call stack frames. More...
 

Namespaces

 ucommon
 Common namespace for all ucommon objects.
 

Macros

#define THROW(x)   throw x
 
#define THROWS(x)   throw(x)
 
#define THROWS_ANY   throw()
 

Functions

template<typename T >
bool ucommon::bound (const T *pointer, const T *base, size_t count)
 Convenience function to check memory arrays. More...
 
template<typename T >
T & ucommon::clear (T &o)
 
template<typename T >
ucommon::copy (const T &src)
 Convenience function to copy objects.
 
template<typename T >
T & ucommon::copy (const T &src, T &to)
 
template<typename T >
void ucommon::copy_unsafe (T *target, const T *source)
 Convenience function to copy class. More...
 
template<typename T >
T & ucommon::deref_pointer (T *pointer)
 Convert a pointer to a reference with type checking. More...
 
template<typename T >
T * ucommon::dup (const T &object)
 Convenience function to duplicate object pointer to heap. More...
 
template<>
char * ucommon::dup< char > (const char &object)
 
template<typename T >
void ucommon::dupfree (T object)
 
template<>
void ucommon::dupfree< char * > (char *object)
 
template<typename T >
bool ucommon::is (T &object)
 Convenience function to validate object assuming it is castable to bool. More...
 
template<typename T >
bool ucommon::isnull (T &object)
 Convenience function to test pointer object. More...
 
template<typename T >
bool ucommon::isnullp (T *object)
 Convenience function to test pointer-pointer object. More...
 
template<typename T >
T &() ucommon::limit (T &value, T &low, T &high)
 Convenience macro to range restrict values. More...
 
template<typename T >
T &() ucommon::max (T &o1, T &o2)
 Convenience function to return max of two objects. More...
 
template<typename T >
T &() ucommon::min (T &o1, T &o2)
 Convenience function to return min of two objects. More...
 
template<typename T >
T & ucommon::move (T &src, T &to)
 Convenience function to move objects.
 
template<typename T >
void ucommon::reset_unsafe (T &object)
 Convenience function to reset an existing object. More...
 
template<typename T >
void ucommon::store_unsafe (T &target, const T *source)
 Convenience function to store object pointer into object. More...
 
template<typename T >
void ucommon::swap (T &o1, T &o2)
 Convenience function to swap objects. More...
 
template<typename T >
void ucommon::zero_unsafe (T &object)
 Convenience function to zero an object and restore type info. More...
 

Detailed Description

Generic templates for C++.

These are templates that do not depend on any ucommon classes. They can be used for generic C++ programming.

Definition in file generics.h.