csArraySafeCopyElementHandler< T > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions
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 | MoveElements (T *mem, size_t dest, size_t src, size_t count)
| Move elements inside a region.
static void | MoveElementsNoOverlap (T *mem, size_t dest, size_t src, size_t count)
template<typename Allocator >
static T * | ResizeRegion (Allocator &alloc, T *mem, size_t relevantcount, size_t oldcount, size_t newcount)
| Reallocate 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 179 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 240 of file array.h.

template<class T >

static void csArraySafeCopyElementHandler< T >::MoveElementsNoOverlap | ( | 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 264 of file array.h.

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]`

Reallocate 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 209 of file array.h.

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

- csutil/array.h