GCC Middle and Back End API Reference
auto_vec< T, N > Class Template Reference

#include <vec.h>

Inherits vec< T, va_heap >.

Collaboration diagram for auto_vec< T, N >:

Public Member Functions

 auto_vec ()
 
 auto_vec (size_t s CXX_MEM_STAT_INFO)
 
 ~auto_vec ()
 
vec< T, va_heapto_vec_legacy ()
 

Private Attributes

vec< T, va_heap, vl_embedm_auto
 
unsigned char m_data [sizeof(T) *N]
 

Detailed Description

template<typename T, size_t N>
class auto_vec< T, N >
Space efficient vector.  These vectors can grow dynamically and are
allocated together with their control data.  They are suited to be
included in data structures.  Prior to initial allocation, they
only take a single word of storage.

These vectors are implemented as a pointer to an embeddable vector.
The semantics allow for this pointer to be NULL to represent empty
vectors.  This way, empty vectors occupy minimal space in the
structure containing them.

Properties:

     - The whole vector and control data are allocated in a single
       contiguous block.
     - The whole vector may be re-allocated.
     - Vector data may grow and shrink.
     - Access and manipulation requires a pointer test and
       indirection.
     - It requires 1 word of storage (prior to vector allocation).


Limitations:

These vectors must be PODs because they are stored in unions.
(http://en.wikipedia.org/wiki/Plain_old_data_structures).
As long as we use C++03, we cannot have constructors nor
destructors in classes that are stored in unions.   
auto_vec is a subclass of vec that automatically manages creating and
releasing the internal vector. If N is non zero then it has N elements of
internal storage.  The default is no internal storage, and you probably only
want to ask for internal storage for vectors on the stack because if the
size of the vector is larger than the internal storage that space is wasted.

Constructor & Destructor Documentation

◆ auto_vec() [1/2]

template<typename T , size_t N>
auto_vec< T, N >::auto_vec ( )
inline

References auto_vec< T, N >::m_auto, and N.

◆ auto_vec() [2/2]

template<typename T , size_t N>
auto_vec< T, N >::auto_vec ( size_t s CXX_MEM_STAT_INFO)
inline

◆ ~auto_vec()

template<typename T , size_t N>
auto_vec< T, N >::~auto_vec ( )
inline

Member Function Documentation

◆ to_vec_legacy()

template<typename T , size_t N>
vec< T, va_heap > auto_vec< T, N >::to_vec_legacy ( )
inline

Field Documentation

◆ m_auto

template<typename T , size_t N>
vec<T, va_heap, vl_embed> auto_vec< T, N >::m_auto
private

◆ m_data

template<typename T , size_t N>
unsigned char auto_vec< T, N >::m_data[sizeof(T) *N]
private

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