Public Member Functions | Private Attributes | List of all members
gnsstk::VectorSlice< T > Class Template Reference

Detailed Description

template<class T>
class gnsstk::VectorSlice< T >

A slice of Vector<T> that can be modified.

Warning
Remember that (VectorSlice = VectorSlice) will assign elements to the VectorSlice, not copy the VectorSlice internal data!

Definition at line 57 of file Vector.hpp.

#include <Vector.hpp>

Public Member Functions

T & operator() (size_t i)
 Returns the modifiable i'th element of the slice. More...
 
operator() (size_t i) const
 Returns the const i'th element of the slice. More...
 
template<class V >
VectorSliceoperator= (const ConstVectorBase< T, V > &x)
 Assign the elements of this slice from another vector. More...
 
VectorSliceoperator= (const std::valarray< T > &x)
 Assign the elements of this slice from a valarray. More...
 
VectorSliceoperator= (const T *x)
 Assign (*this).size() elements from x to (*this). More...
 
VectorSliceoperator= (const T x)
 Assign all the elements of this slice to x. More...
 
T & operator[] (size_t i)
 Returns the modifiable i'th element of the slice. More...
 
operator[] (size_t i) const
 Returns the const i'th element of the slice. More...
 
size_t size () const
 returns the number of elements in the slice More...
 
size_t start () const
 returns the index in the vector of the first element. More...
 
size_t stride () const
 
 VectorSlice ()
 Default constructor. More...
 
 VectorSlice (Vector< T > &vv)
 Makes a slice of the whole vector. More...
 
 VectorSlice (Vector< T > &vv, const std::slice &ss)
 Makes a slice of the vector with the given std::slice. More...
 

Private Attributes

std::slice s
 the slice specification. More...
 
Vector< T > * v
 the vector used as a source for the slice More...
 

Constructor & Destructor Documentation

◆ VectorSlice() [1/3]

template<class T >
gnsstk::VectorSlice< T >::VectorSlice ( )
inline

Default constructor.

Definition at line 386 of file Vector.hpp.

◆ VectorSlice() [2/3]

template<class T >
gnsstk::VectorSlice< T >::VectorSlice ( Vector< T > &  vv)
inline

Makes a slice of the whole vector.

Definition at line 391 of file Vector.hpp.

◆ VectorSlice() [3/3]

template<class T >
gnsstk::VectorSlice< T >::VectorSlice ( Vector< T > &  vv,
const std::slice &  ss 
)
inline

Makes a slice of the vector with the given std::slice.

Definition at line 396 of file Vector.hpp.

Member Function Documentation

◆ operator()() [1/2]

template<class T >
T& gnsstk::VectorSlice< T >::operator() ( size_t  i)
inline

Returns the modifiable i'th element of the slice.

Definition at line 424 of file Vector.hpp.

◆ operator()() [2/2]

template<class T >
T gnsstk::VectorSlice< T >::operator() ( size_t  i) const
inline

Returns the const i'th element of the slice.

Definition at line 427 of file Vector.hpp.

◆ operator=() [1/4]

template<class T >
template<class V >
VectorSlice& gnsstk::VectorSlice< T >::operator= ( const ConstVectorBase< T, V > &  x)
inline

Assign the elements of this slice from another vector.

Definition at line 402 of file Vector.hpp.

◆ operator=() [2/4]

template<class T >
VectorSlice& gnsstk::VectorSlice< T >::operator= ( const std::valarray< T > &  x)
inline

Assign the elements of this slice from a valarray.

Definition at line 406 of file Vector.hpp.

◆ operator=() [3/4]

template<class T >
VectorSlice& gnsstk::VectorSlice< T >::operator= ( const T *  x)
inline

Assign (*this).size() elements from x to (*this).

Definition at line 414 of file Vector.hpp.

◆ operator=() [4/4]

template<class T >
VectorSlice& gnsstk::VectorSlice< T >::operator= ( const x)
inline

Assign all the elements of this slice to x.

Definition at line 410 of file Vector.hpp.

◆ operator[]() [1/2]

template<class T >
T& gnsstk::VectorSlice< T >::operator[] ( size_t  i)
inline

Returns the modifiable i'th element of the slice.

Definition at line 418 of file Vector.hpp.

◆ operator[]() [2/2]

template<class T >
T gnsstk::VectorSlice< T >::operator[] ( size_t  i) const
inline

Returns the const i'th element of the slice.

Definition at line 421 of file Vector.hpp.

◆ size()

template<class T >
size_t gnsstk::VectorSlice< T >::size ( ) const
inline

returns the number of elements in the slice

Definition at line 431 of file Vector.hpp.

◆ start()

template<class T >
size_t gnsstk::VectorSlice< T >::start ( ) const
inline

returns the index in the vector of the first element.

Definition at line 433 of file Vector.hpp.

◆ stride()

template<class T >
size_t gnsstk::VectorSlice< T >::stride ( ) const
inline

returns the number of elements to skip between (*this)[i] and (*this)[i+1]

Definition at line 436 of file Vector.hpp.

Member Data Documentation

◆ s

template<class T >
std::slice gnsstk::VectorSlice< T >::s
private

the slice specification.

Definition at line 441 of file Vector.hpp.

◆ v

template<class T >
Vector<T>* gnsstk::VectorSlice< T >::v
private

the vector used as a source for the slice

Definition at line 439 of file Vector.hpp.


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


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:46