NeoPZ
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Vector< T > Class Template Reference

#include <vectors.h>

Public Types

typedef T value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typeiterator
 
typedef const value_typeconst_iterator
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 Vector ()
 
 Vector (int csize)
 
 Vector (int csize, const T &val)
 
 Vector (const Vector< T > &a)
 
 ~Vector ()
 
T & operator[] (int)
 
const T & operator[] (int) const
 
T & operator() (int)
 
const T & operator() (int) const
 
Vector< T > & operator= (const Vector< T > &a)
 
Vector< T > & operator= (const T &val)
 
Vector< T > & operator+= (const Vector< T > &a)
 
Vector< T > & operator-= (const Vector< T > &a)
 
int empty () const
 
void reserve (int)
 
void resize (int)
 
int size () const
 
int length () const
 
int capacity () const
 
T * begin () const
 
T * end () const
 
void destroy ()
 
int no (const T *ptr) const
 

Private Member Functions

void copy (const Vector< T > &a)
 

Private Attributes

int num_elts
 
T *RESTRICT ptr_to_data
 

Detailed Description

template<class T>
class Vector< T >

Definition at line 81 of file vectors.h.

Member Typedef Documentation

◆ const_iterator

template<class T>
typedef const value_type* Vector< T >::const_iterator

Definition at line 88 of file vectors.h.

◆ const_pointer

template<class T>
typedef const value_type* Vector< T >::const_pointer

Definition at line 86 of file vectors.h.

◆ const_reference

template<class T>
typedef const value_type& Vector< T >::const_reference

Definition at line 90 of file vectors.h.

◆ difference_type

template<class T>
typedef ptrdiff_t Vector< T >::difference_type

Definition at line 92 of file vectors.h.

◆ iterator

template<class T>
typedef value_type* Vector< T >::iterator

Definition at line 87 of file vectors.h.

◆ pointer

template<class T>
typedef value_type* Vector< T >::pointer

Definition at line 85 of file vectors.h.

◆ reference

template<class T>
typedef value_type& Vector< T >::reference

Definition at line 89 of file vectors.h.

◆ size_type

template<class T>
typedef size_t Vector< T >::size_type

Definition at line 91 of file vectors.h.

◆ value_type

template<class T>
typedef T Vector< T >::value_type

Definition at line 84 of file vectors.h.

Constructor & Destructor Documentation

◆ Vector() [1/4]

template<class T >
Vector< T >::Vector ( )
inline

Definition at line 209 of file vectors.h.

References Vector< T >::ptr_to_data.

◆ Vector() [2/4]

template<class T >
Vector< T >::Vector ( int  csize)
inline

Definition at line 222 of file vectors.h.

References error(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

◆ Vector() [3/4]

template<class T >
Vector< T >::Vector ( int  csize,
const T &  val 
)

Definition at line 376 of file vectors.h.

References error(), Vector< T >::num_elts, Vector< T >::ptr_to_data, and val().

◆ Vector() [4/4]

template<class T >
Vector< T >::Vector ( const Vector< T > &  a)
inline

Definition at line 242 of file vectors.h.

References Vector< T >::copy(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

◆ ~Vector()

template<class T >
Vector< T >::~Vector ( )

Definition at line 405 of file vectors.h.

References Vector< T >::destroy().

Member Function Documentation

◆ begin()

template<class T >
T * Vector< T >::begin ( ) const
inline

◆ capacity()

template<class T >
int Vector< T >::capacity ( ) const
inline

Definition at line 363 of file vectors.h.

References Vector< T >::num_elts.

◆ copy()

template<class T >
void Vector< T >::copy ( const Vector< T > &  a)
private

◆ destroy()

template<class T >
void Vector< T >::destroy ( )
inline

◆ empty()

template<class T>
int Vector< T >::empty ( ) const
inline

Definition at line 129 of file vectors.h.

◆ end()

template<class T>
T* Vector< T >::end ( ) const
inline

Definition at line 136 of file vectors.h.

◆ length()

template<class T>
int Vector< T >::length ( ) const
inline

Definition at line 133 of file vectors.h.

◆ no()

template<class T>
int Vector< T >::no ( const T *  ptr) const
inline

Definition at line 138 of file vectors.h.

References MEM_CPY< T >::copy().

◆ operator()() [1/2]

template<class T >
T & Vector< T >::operator() ( int  i)
inline

Definition at line 307 of file vectors.h.

References Vector< T >::operator[]().

◆ operator()() [2/2]

template<class T >
const T & Vector< T >::operator() ( int  i) const
inline

Definition at line 312 of file vectors.h.

References Vector< T >::operator[]().

◆ operator+=()

template<class T>
Vector< T >& Vector< T >::operator+= ( const Vector< T > &  a)
inline

Definition at line 111 of file vectors.h.

References error(), and Vector< T >::size().

◆ operator-=()

template<class T>
Vector< T >& Vector< T >::operator-= ( const Vector< T > &  a)
inline

Definition at line 119 of file vectors.h.

References error(), and Vector< T >::size().

◆ operator=() [1/2]

template<class T >
Vector< T > & Vector< T >::operator= ( const Vector< T > &  a)

◆ operator=() [2/2]

template<class T >
Vector< T > & Vector< T >::operator= ( const T &  val)

Definition at line 441 of file vectors.h.

References error(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

◆ operator[]() [1/2]

template<class T >
T & Vector< T >::operator[] ( int  i)
inline

Definition at line 276 of file vectors.h.

References error(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

Referenced by Vector< T >::operator()().

◆ operator[]() [2/2]

template<class T >
const T & Vector< T >::operator[] ( int  i) const
inline

Definition at line 292 of file vectors.h.

References error(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

◆ reserve()

template<class T >
void Vector< T >::reserve ( int  ssize)
inline

Definition at line 319 of file vectors.h.

References error(), Vector< T >::num_elts, and Vector< T >::ptr_to_data.

Referenced by Vector< T >::operator=().

◆ resize()

template<class T >
void Vector< T >::resize ( int  ssize)
inline

◆ size()

template<class T>
int Vector< T >::size ( ) const
inline

Member Data Documentation

◆ num_elts

template<class T>
int Vector< T >::num_elts
private

◆ ptr_to_data

template<class T>
T* RESTRICT Vector< T >::ptr_to_data
private

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