Scopira  20080306
scopira::tool::fixed_array< T, N > Class Template Reference

#include <array.h>

Public Types

enum  { size_c = N }
 
typedef T data_type
 
typedef T * iterator
 
typedef const T * const_iterator
 

Public Member Functions

T * array (void)
 
const T * array (void) const
 
T * c_array (void)
 
const T * c_array (void) const
 
iterator begin (void)
 
iterator end (void)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
void clear_zero (void)
 
size_t size (void) const
 
bool empty (void) const
 
void set (size_t idx, const T &v)
 
const T & get (size_t idx) const
 
T & get (size_t idx)
 
const T & operator[] (size_t idx) const
 
T & operator[] (size_t idx)
 

Protected Attributes

dm_ary [N]
 

Detailed Description

template<class T, size_t N>
class scopira::tool::fixed_array< T, N >

A FIXED size array of type T and length N. This is exactly the same as doing T[N], but nicer.

Default constructors and destructors are fine. This object is POD-like and thus is fully copyable.

See tool/util for a handy string to fixed_array routine (string_to_array) if you'd like to use fixed_array as a safe C string.

Author
Aleksander Demko

Member Function Documentation

◆ array() [1/2]

template<class T, size_t N>
T* scopira::tool::fixed_array< T, N >::array ( void  )
inline

Raw access to the array

Author
Aleksander Demko

◆ array() [2/2]

template<class T, size_t N>
const T* scopira::tool::fixed_array< T, N >::array ( void  ) const
inline

Raw access to the array

Author
Aleksander Demko

◆ begin() [1/2]

template<class T, size_t N>
iterator scopira::tool::fixed_array< T, N >::begin ( void  )
inline

◆ begin() [2/2]

template<class T, size_t N>
const_iterator scopira::tool::fixed_array< T, N >::begin ( void  ) const
inline

STL-like iteration

Author
Aleksander Demko

◆ c_array() [1/2]

template<class T, size_t N>
T* scopira::tool::fixed_array< T, N >::c_array ( void  )
inline

Raw access to the array

Author
Aleksander Demko

Referenced by scopira::tool::hybrid_array< T, RES >::resize().

◆ c_array() [2/2]

template<class T, size_t N>
const T* scopira::tool::fixed_array< T, N >::c_array ( void  ) const
inline

Raw access to the array

Author
Aleksander Demko

◆ clear_zero()

template<class T, size_t N>
void scopira::tool::fixed_array< T, N >::clear_zero ( void  )
inline

Clears all the array values to binary 0. Does not resize the array. This is dangerous on non-POD classes.

Author
Aleksander Demko

◆ empty()

template<class T, size_t N>
bool scopira::tool::fixed_array< T, N >::empty ( void  ) const
inline

Is the array empty (0 length)?

Author
Aleksander Demko

◆ end() [1/2]

template<class T, size_t N>
iterator scopira::tool::fixed_array< T, N >::end ( void  )
inline

◆ end() [2/2]

template<class T, size_t N>
const_iterator scopira::tool::fixed_array< T, N >::end ( void  ) const
inline

STL-like iteration

Author
Aleksander Demko

◆ get() [1/2]

template<class T, size_t N>
const T& scopira::tool::fixed_array< T, N >::get ( size_t  idx) const
inline

◆ get() [2/2]

template<class T, size_t N>
T& scopira::tool::fixed_array< T, N >::get ( size_t  idx)
inline

Individual element setter

Author
Aleksander Demko

◆ operator[]() [1/2]

template<class T, size_t N>
const T& scopira::tool::fixed_array< T, N >::operator[] ( size_t  idx) const
inline

Nice reference access

Author
Aleksander Demko

◆ operator[]() [2/2]

template<class T, size_t N>
T& scopira::tool::fixed_array< T, N >::operator[] ( size_t  idx)
inline

Nice reference access

Author
Aleksander Demko

◆ set()

template<class T, size_t N>
void scopira::tool::fixed_array< T, N >::set ( size_t  idx,
const T &  v 
)
inline

Individual element setter

Author
Aleksander Demko

◆ size()

template<class T, size_t N>
size_t scopira::tool::fixed_array< T, N >::size ( void  ) const
inline

Gets the size of the array

Author
Aleksander Demko

Referenced by scopira::basekit::nslice< T, DIM >::load().


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