Generic templates for C++. More...
#include <ucommon/cpr.h>#include <stdlib.h>#include <string.h>#include <stdexcept>

Go to the source code of this file.
Data Structures | |
| class | array_pointer< T > |
| Generic smart array class. More... | |
| class | pointer< T > |
| Generic smart pointer class. More... | |
| class | save_restore< T > |
| Save and restore global objects in function call stack frames. More... | |
| class | temp_array< T > |
| Manage temporary array stored on the heap. More... | |
| class | temporary< T > |
| Manage temporary object stored on the heap. More... | |
Defines | |
| #define | THROW(x) throw x |
| #define | THROWS(x) throw(x) |
| #define | THROWS_ANY throw() |
Functions | |
| template<typename T > | |
| void | copy_unsafe (T *target, const T *source) |
| Convenience function to copy class. | |
| template<typename T > | |
| T * | dup (const T &object) |
| Convenience function to duplicate object pointer to heap. | |
| template<> | |
| char * | dup< char > (const char &object) |
| template<typename T > | |
| void | dupfree (T object) |
| template<> | |
| void | dupfree< char * > (char *object) |
| template<class T > | |
| bool | is (T &object) |
| Convenience function to validate object assuming it is castable to bool. | |
| template<typename T > | |
| bool | isnull (T &object) |
| Convenience function to test pointer object. | |
| template<typename T > | |
| bool | isnullp (T *object) |
| Convenience function to test pointer-pointer object. | |
| template<typename T > | |
| T &() | limit (T &value, T &low, T &high) |
| Convenience macro to range restrict values. | |
| template<typename T > | |
| T &() | max (T &o1, T &o2) |
| Convenience function to return max of two objects. | |
| template<typename T > | |
| T &() | min (T &o1, T &o2) |
| Convenience function to return min of two objects. | |
| template<typename T > | |
| void | reset_unsafe (T &object) |
| Convenience function to reset an existing object. | |
| template<typename T > | |
| void | store_unsafe (T &target, const T *source) |
| Convenience function to store object pointer into object. | |
| template<typename T > | |
| void | swap (T &o1, T &o2) |
| Convenience function to swap objects. | |
| template<typename T > | |
| void | zero_unsafe (T &object) |
| Convenience function to zero an object and restore type info. | |
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.
| void copy_unsafe | ( | T * | target, | |
| const T * | source | |||
| ) | [inline] |
Convenience function to copy class.
| target | to copy into. | |
| source | to copy from. |
Definition at line 515 of file generics.h.
| T* dup | ( | const T & | object | ) | [inline] |
Convenience function to duplicate object pointer to heap.
| object | we are duping. |
Definition at line 478 of file generics.h.
| bool is | ( | T & | object | ) | [inline] |
Convenience function to validate object assuming it is castable to bool.
| object | we are testing. |
Definition at line 449 of file generics.h.
| bool isnull | ( | T & | object | ) | [inline] |
Convenience function to test pointer object.
This solves issues where some compilers get confused between bool and pointer operators.
| object | we are testing. |
Definition at line 459 of file generics.h.
| bool isnullp | ( | T * | object | ) | [inline] |
Convenience function to test pointer-pointer object.
This solves issues where some compilers get confused between bool and pointer operators.
| object | we are testing. |
Definition at line 469 of file generics.h.
| T&() limit | ( | T & | value, | |
| T & | low, | |||
| T & | high | |||
| ) | [inline] |
Convenience macro to range restrict values.
| value | to check. | |
| low | value. | |
| high | value. |
Definition at line 568 of file generics.h.
| T&() max | ( | T & | o1, | |
| T & | o2 | |||
| ) | [inline] |
Convenience function to return max of two objects.
| o1 | to check. | |
| o2 | to check. |
Definition at line 543 of file generics.h.
| T&() min | ( | T & | o1, | |
| T & | o2 | |||
| ) | [inline] |
Convenience function to return min of two objects.
| o1 | to check. | |
| o2 | to check. |
Definition at line 555 of file generics.h.
| void reset_unsafe | ( | T & | object | ) | [inline] |
Convenience function to reset an existing object.
| object | type to reset. |
Definition at line 498 of file generics.h.
| void store_unsafe | ( | T & | target, | |
| const T * | source | |||
| ) | [inline] |
Convenience function to store object pointer into object.
| target | to copy into. | |
| source | to copy from. |
Definition at line 524 of file generics.h.
| void swap | ( | T & | o1, | |
| T & | o2 | |||
| ) | [inline] |
Convenience function to swap objects.
| o1 | to swap. | |
| o2 | to swap. |
Definition at line 533 of file generics.h.

| void zero_unsafe | ( | T & | object | ) | [inline] |
Convenience function to zero an object and restore type info.
| object | to zero in memory. |
Definition at line 506 of file generics.h.
1.6.1