Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

SafeSTLVector< T > Class Template Reference

#include <safe_vectors.h>

Inheritance diagram for SafeSTLVector< T >:

vector List of all members.

template<class T>
class SafeSTLVector< T >


Public Types

typedef size_t size_type

Public Methods

 SafeSTLVector (void)
T & operator[] (const size_type i)

Public Attributes

string name

Member Typedef Documentation

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

Definition at line 33 of file safe_vectors.h.

Referenced by SafeSTLVector< unsigned >::operator[]().


Constructor & Destructor Documentation

template<class T>
SafeSTLVector< T >::SafeSTLVector void    [inline]
 

It returns a reference to element i with range-cheching. Note that element index starting from 0.

Definition at line 38 of file safe_vectors.h.

00038 {name = "unknown";}


Member Function Documentation

template<class T>
T& SafeSTLVector< T >::operator[] const size_type    i [inline]
 

Definition at line 39 of file safe_vectors.h.

00039                                            {
00040                 if (i >= vector<T>::size()) {
00041                         cout << "out of range error in SafeSTLVector: " << name << endl;
00042                         cout << "i = " << i << endl;
00043                         cout << "size of vector = " << vector<T>::size() << endl;
00044                         throw matvec::exception("SafeSTLVector: out of range error");
00045                         exit(1);
00046                 }
00047                 return *(vector<T>::begin() + i) ;
00048         }


Member Data Documentation

template<class T>
string SafeSTLVector< T >::name
 

Definition at line 32 of file safe_vectors.h.

Referenced by SafeSTLVector< unsigned >::operator[](), and SafeSTLVector< unsigned >::SafeSTLVector().


The documentation for this class was generated from the following file:
Generated on Thu Jun 16 17:14:12 2005 for Matvec by doxygen1.2.16