ArrayView< T > Class Template Reference

This class is a duplicate of Array and can be cast to an Array with no harm. More...

#include <Array.h>

Inheritance diagram for ArrayView< T >:
ArrayBase< T >

List of all members.

Public Member Functions

 ArrayView (const ArrayView &v)
 ArrayView (const Base &l)
 ~ArrayView ()
 ArrayView (const ArrayView &a, int offset, int length)
 ArrayView (ArrayView &a, int offset, int length)
ArrayView operator() (int offset, int length) const
ArrayView operator() (int offset, int length)
ArrayViewoperator= (const ArrayView &v)
ArrayViewoperator= (const Base &b)
 operator const Array< T > & () const
 operator Array< T > & ()

Detailed Description

template<class T>
class SimTK::ArrayView< T >

This class is a duplicate of Array and can be cast to an Array with no harm.

However, this provides an alternate type of temporary object so that we can force copy construction when appropriate. Assume a is an Array. Then we want identical behavior for all of these: Array b(a); Array b=a; {Array b; b=a; } // b is a COPY of a and Array b(a(2,3)); Array b=a(2,3)); { Array b; b=a(2,3); } // b is a 3-element COPY of a[2],a[3],a[4]. This won't happen without special handling because the compiler is permitted to skip the copy constructor if a(2,3) were to return an Array, in which case Array b(a(2,3)) MIGHT end up a view rather than a copy. The same applies for functions returning Array when used to construct another Array -- the compiler is free to avoid the temporary by constructing directly into the destination, meaning you could get an unwanted view.


Constructor & Destructor Documentation

ArrayView ( const ArrayView< T > &  v  )  [inline]
ArrayView ( const Base l  )  [inline, explicit]
~ArrayView (  )  [inline]
ArrayView ( const ArrayView< T > &  a,
int  offset,
int  length 
) [inline]
ArrayView ( ArrayView< T > &  a,
int  offset,
int  length 
) [inline]

Member Function Documentation

operator Array< T > & (  )  [inline]
operator const Array< T > & (  )  const [inline]
ArrayView operator() ( int  offset,
int  length 
) [inline]
ArrayView operator() ( int  offset,
int  length 
) const [inline]
ArrayView& operator= ( const Base b  )  [inline]
ArrayView& operator= ( const ArrayView< T > &  v  )  [inline]

Reimplemented from ArrayBase< T >.

References ArrayBase< T >::operator=().


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

Generated on Wed Dec 30 11:05:17 2009 for SimTKcore by  doxygen 1.6.1