CppAD: A C++ Algorithmic Differentiation Package  20130102
pod_vector< Type > Class Template Reference

A vector class with Type element that does not use element constructors or destructors when Type is Plain Old Data (pod). More...

List of all members.

Public Member Functions

 pod_vector (size_t max_length=std::numeric_limits< size_t >::max())
 Constructors set capacity, length, and data to zero.
 ~pod_vector (void)
 Destructor: returns allocated memory to thread_alloc; see extend. If this is not plain old data, the destructor for each element is called.
size_t size (void) const
 current number of elements in this vector.
size_t capacity (void) const
 current capacity (amount of allocated storage) for this vector.
Type * data (void)
 current data pointer, no longer valid after any of the following: extend, erase, operator=, and ~pod_vector. Take extreem care when using this function.
const Type * data (void) const
 const version of data pointer
size_t extend (size_t n)
 Increase the number of elements the end of this vector.
Type & operator[] (size_t i)
 non-constant element access; i.e., we can change this element value
const Type & operator[] (size_t i) const
 constant element access; i.e., we cannot change this element value
void erase (void)
 Remove all the elements from this vector but leave the capacity and data pointer as is.
void free (void)
 Remove all the elements from this vector and delete its memory.
void operator= (const pod_vector &x)
 vector assignment operator If the resulting length of the vector would be more than max_length_, and NDEBUG is not defined, a CPPAD_ASSERT is generated.
void swap (pod_vector &other)
 Swap all properties of this vector with another.

Private Member Functions

 pod_vector (const pod_vector &)
 do not use the copy constructor

Private Attributes

size_t max_length_
 maximum number of elements that should ever be in this vector
size_t length_
 number of elements currently in this vector
size_t capacity_
 maximum number of Type elements current allocation can hold
Type * data_
 pointer to the first type elements (not defined and should not be used when capacity_ = 0)

Detailed Description

template<class Type>
class pod_vector< Type >

A vector class with Type element that does not use element constructors or destructors when Type is Plain Old Data (pod).

Definition at line 54 of file pod_vector.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines