Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Macros Pages
Public Types | Public Member Functions | Protected Attributes
ArrayView< T > Class Template Reference

Array view. More...

#include <arrays.h>

Inheritance diagram for ArrayView< T >:
Inheritance graph
[legend]

Public Types

typedef T DataType
 
typedef T * iterator
 
typedef T const * const_iterator
 

Public Member Functions

 ArrayView ()
 
 ArrayView (size_t n, T *ptr)
 
 ArrayView (ArrayView< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (Array< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (NumberArray< T > const &a, size_t i=0, size_t n=0)
 
 ArrayView (const_iterator i, const_iterator j)
 
 ArrayView (ArrayView< T > &&r)
 
virtual ~ArrayView ()
 
ArrayView< T > & operator= (const ArrayView< T > v)
 Assignment operator. More...
 
T & operator[] (size_t i)
 Element-wise access (non-const). More...
 
T const & operator[] (size_t i) const
 Element-wise access (const). More...
 
size_t size () const
 Length of the array (number of elements). More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
T & front (int i=0)
 
T const & front (int i=0) const
 
T & back (int i=0)
 
T const & back (int i=0) const
 
void fill (T x)
 Fill the array with a value. More...
 
bool empty () const
 Check whether the size is equal to zero. More...
 
template<class = typename std::enable_if<is_scalar<T>::value>>
double norm () const
 Two-norm (defined only for scalar data type). More...
 
virtual T * data ()
 Pointer to the data. More...
 
virtual T const * data () const
 

Protected Attributes

size_t N_
 Number of elements in the array. More...
 
T * array_
 Pointer to the array. More...
 

Detailed Description

template<class T>
class ArrayView< T >

This class holds a shallow copy of an array of items of type T. The view is represented by a pointer to the first item and by the total number of elements. It is offers a comfortable means for work with subarrays. Also, it is a base class for derived data types Array and CLArrayView, that add some advanced functionality to the plain pointer-and-size storage.

ArrayView neither allocates nor deallocates any memory.

Member Typedef Documentation

template<class T>
typedef T const* ArrayView< T >::const_iterator
template<class T>
typedef T ArrayView< T >::DataType
template<class T>
typedef T* ArrayView< T >::iterator

Constructor & Destructor Documentation

template<class T>
ArrayView< T >::ArrayView ( )
inline
template<class T>
ArrayView< T >::ArrayView ( size_t  n,
T *  ptr 
)
inline
template<class T>
ArrayView< T >::ArrayView ( ArrayView< T > const &  a,
size_t  i = 0,
size_t  n = 0 
)
inline
template<class T>
ArrayView< T >::ArrayView ( Array< T > const &  a,
size_t  i = 0,
size_t  n = 0 
)
inline
template<class T>
ArrayView< T >::ArrayView ( NumberArray< T > const &  a,
size_t  i = 0,
size_t  n = 0 
)
inline
template<class T>
ArrayView< T >::ArrayView ( const_iterator  i,
const_iterator  j 
)
inline
template<class T>
ArrayView< T >::ArrayView ( ArrayView< T > &&  r)
inline
template<class T>
virtual ArrayView< T >::~ArrayView ( )
inlinevirtual

Member Function Documentation

template<class T>
T& ArrayView< T >::back ( int  i = 0)
inline
template<class T>
T const& ArrayView< T >::back ( int  i = 0) const
inline
template<class T>
iterator ArrayView< T >::begin ( )
inline
template<class T>
const_iterator ArrayView< T >::begin ( ) const
inline
template<class T>
virtual T* ArrayView< T >::data ( )
inlinevirtual
template<class T>
virtual T const* ArrayView< T >::data ( ) const
inlinevirtual
template<class T>
bool ArrayView< T >::empty ( ) const
inline
template<class T>
iterator ArrayView< T >::end ( )
inline
template<class T>
const_iterator ArrayView< T >::end ( ) const
inline
template<class T>
void ArrayView< T >::fill ( x)
inline
template<class T>
T& ArrayView< T >::front ( int  i = 0)
inline
template<class T>
T const& ArrayView< T >::front ( int  i = 0) const
inline
template<class T>
template<class = typename std::enable_if<is_scalar<T>::value>>
double ArrayView< T >::norm ( ) const
inline
template<class T>
ArrayView<T>& ArrayView< T >::operator= ( const ArrayView< T >  v)
inline
template<class T>
T& ArrayView< T >::operator[] ( size_t  i)
inline
template<class T>
T const& ArrayView< T >::operator[] ( size_t  i) const
inline
template<class T>
size_t ArrayView< T >::size ( ) const
inline

Field Documentation

template<class T>
T* ArrayView< T >::array_
protected
template<class T>
size_t ArrayView< T >::N_
protected

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