ArrayView Class Template Reference

#include <Array.h>

Inheritance diagram for ArrayView:

ArrayBase

List of all members.


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.

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 > & ()


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

ArrayView operator() ( int  offset,
int  length 
) const [inline]

ArrayView operator() ( int  offset,
int  length 
) [inline]

ArrayView& operator= ( const ArrayView< T > &  v  )  [inline]

ArrayView& operator= ( const Base b  )  [inline]

operator const Array< T > & (  )  const [inline]

operator Array< T > & (  )  [inline]


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

Generated on Fri Sep 26 07:44:29 2008 for SimTKcore by  doxygen 1.5.6