CrystalSpace

Public API Reference

csArraySafeCopyElementHandler< T > Class Template Reference
[Containers]

Special element handler for csArray that makes sure that when the array is reallocated that the objects are properly constructed and destructed at their new position. More...

#include <csutil/array.h>

List of all members.

Static Public Member Functions

static void Construct (T *address, T const &src)
static void Construct (T *address)
static void Destroy (T *address)
static void InitRegion (T *address, size_t count)
static void MoveElements (T *mem, size_t dest, size_t src, size_t count)
 Move elements inside a region.
template<typename Allocator>
static T * ResizeRegion (Allocator &alloc, T *mem, size_t relevantcount, size_t oldcount, size_t newcount)
 Reallocates a region allocated by Allocator.


Detailed Description

template<class T>
class csArraySafeCopyElementHandler< T >

Special element handler for csArray that makes sure that when the array is reallocated that the objects are properly constructed and destructed at their new position.

This is needed for objects that can not be safely moved around in memory (like weak references). This is of course slower and that is the reason that this is not done by default.

Definition at line 155 of file array.h.


Member Function Documentation

template<class T>
static void csArraySafeCopyElementHandler< T >::MoveElements ( T *  mem,
size_t  dest,
size_t  src,
size_t  count 
) [inline, static]

Move elements inside a region.

Ensure that all elements are properly moved, ie they are copy-constructed at the new position in memory, the old instance is then destroyed.

Definition at line 212 of file array.h.

References csArraySafeCopyElementHandler< T >::Construct(), and csArraySafeCopyElementHandler< T >::Destroy().

template<class T>
template<typename Allocator>
static T* csArraySafeCopyElementHandler< T >::ResizeRegion ( Allocator &  alloc,
T *  mem,
size_t  relevantcount,
size_t  oldcount,
size_t  newcount 
) [inline, static]

Reallocates a region allocated by Allocator.

Ensure that all elements are properly moved, ie they are copy-constructed at the new position in memory, the old instance is then destroyed.

Definition at line 185 of file array.h.

References csArraySafeCopyElementHandler< T >::Construct(), CS_ASSERT, and csArraySafeCopyElementHandler< T >::Destroy().


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.7