Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Array

Functions

template<class T >
void elm::array::copy (T *target, const T *source, int size)
 
template<class T >
void elm::array::move (T *target, const T *source, int size)
 
template<class T >
void elm::array::set (T *target, int size, const T &v)
 
template<class T >
void elm::array::clear (T *target, int size)
 

Detailed Description

This group provides optimized to work with C native array (whatever the running OS).

Most of these functions uses information of the type provided by the type_info<T> structure to optimize or not the array operations. Particularly, they uses the is_deep definition to know if a value may be copied byte-per-byte or need more complex processing because of its data structure. Any non-scalar type is basically considered as non-deep but you may change this behavior by specializing the type_info for your own type, MyType in the example below:

template <> struct type_info<MyType>: public class_t<MyType> {
enum { is_deep = true };
}

Function Documentation

template<class T >
void elm::array::clear ( T *  target,
int  size 
)

Set the items of an array of the given size to 0.

Parameters
targetTarget array.
sizeSize of both arrays.

Referenced by elm::genstruct::DLList< T, E >::~DLList().

template<class T >
void elm::array::copy ( T *  target,
const T *  source,
int  size 
)

Copy source array of the given size to the target as fast as possible. The arrays must not overlap.

Parameters
targetTarget array.
sourceSource array.
sizeSize of both arrays.

Referenced by elm::WAHVector::copy(), elm::genstruct::DeletableTable< elm::String >::copy(), FixArray::insert(), elm::avl::GenTree< T, K, C >::Iterator::Iterator(), FixArray::removeAt(), and elm::WAHVector::WAHVector().

template<class T >
void elm::array::move ( T *  target,
const T *  source,
int  size 
)

Copy source array of the given size to the target as fast as possible. The arrays may overlap.

Parameters
targetTarget array.
sourceSource array.
sizeSize of both arrays.
template<class T >
void elm::array::set ( T *  target,
int  size,
const T &  v 
)

Set the items of an array of the given size to the given value, as fast as possible.

Parameters
targetTarget array.
sizeSize of both arrays.
vValue to set.

Referenced by elm::genstruct::FragTable< T >::insert(), and elm::genstruct::FragTable< T >::removeAt().