Public Member Functions

mth::Vector< T, 0 > Class Template Reference

run-time (dynamic) vector More...

Inheritance diagram for mth::Vector< T, 0 >:
can::Array< T, 0 >

List of all members.

Public Member Functions

 Vector ()
 default constructor - no allocation
 Vector (unsigned n)
 construct with n elements
T & operator() (unsigned i)
 mutable index operator
T const & operator() (unsigned i) const
 immutable index operator
Vector< T, 0 > & operator+= (Vector< T, 0 > const &b)
 add a vector to this vector
Vector< T, 0 > & operator-= (Vector< T, 0 > const &b)
 subtract a vector from this vector
Vector< T, 0 > & operator*= (T const &s)
 multiply this vector by a scalar
Vector< T, 0 > & operator/= (T const &s)
 divide this vector by a scalar
getLength () const
 get the vector magnitude
void zero ()
 zero the vector

Detailed Description

template<class T>
class mth::Vector< T, 0 >

run-time (dynamic) vector

A runtime-sized equivalent of mth::Vector<T,N>. All values are stored in a single dynamically allocated array. Due to the use of dynamic allocation, users should avoid copying class as much as possible. To help with this, we provide things like operator+= instead of operator+ to discourage users from creating temporary copies. The code for these methods is inlined in an effort to keep linear algebra running quickly

Definition at line 132 of file mthVector.h.


Member Function Documentation

template<class T >
T& mth::Vector< T, 0 >::operator() ( unsigned  i  )  [inline]

mutable index operator

An index operator (i) is provided so that mth::Vector and mth::Matrix share a common index operator

Definition at line 142 of file mthVector.h.

{return (*this)[i];}


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