Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JArrayIterator< N, T > Struct Template Reference

ND array iterator. More...

#include <JArrayIterator.hh>

Public Member Functions

 JArrayIterator (const JAbstractCollection< T > &collection)
 Constructor.
 
 operator bool () const
 Check validity of iterator.
 
JArray< N, double > operator* () const
 Get current value.
 
JArrayIteratoroperator++ ()
 Prefix increment.
 
JArrayIterator operator++ (int)
 Postfix increment.
 

Private Attributes

int i
 

Detailed Description

template<int N, class T>
struct JTOOLS::JArrayIterator< N, T >

ND array iterator.

Definition at line 21 of file JArrayIterator.hh.

Constructor & Destructor Documentation

◆ JArrayIterator()

template<int N, class T >
JTOOLS::JArrayIterator< N, T >::JArrayIterator ( const JAbstractCollection< T > & collection)
inline

Constructor.

Parameters
collectionabscissa values

Definition at line 29 of file JArrayIterator.hh.

29 :
30 JArrayIterator<N - 1, T>(collection)
31 {
32 i = 0;
33 }
JArrayIterator(const JAbstractCollection< T > &collection)
Constructor.

Member Function Documentation

◆ operator bool()

template<int N, class T >
JTOOLS::JArrayIterator< N, T >::operator bool ( ) const
inline

Check validity of iterator.

Returns
true if valid; else false

Definition at line 41 of file JArrayIterator.hh.

42 {
43 return i != this->collection.getSize() && JArrayIterator<N-1, T>::operator bool();
44 }

◆ operator*()

template<int N, class T >
JArray< N, double > JTOOLS::JArrayIterator< N, T >::operator* ( ) const
inline

Get current value.

Returns
value

Definition at line 52 of file JArrayIterator.hh.

53 {
54 return JArray<N, double>(JArrayIterator<N-1, T>::operator *(), this->collection.getX(i));
55 }

◆ operator++() [1/2]

template<int N, class T >
JArrayIterator & JTOOLS::JArrayIterator< N, T >::operator++ ( )
inline

Prefix increment.

Returns
this array sampler

Definition at line 63 of file JArrayIterator.hh.

64 {
65 if (++i == this->collection.getSize()) {
66
67 i = 0; // rewind
68
70 }
71
72 return *this;
73 }
JArrayIterator & operator++()
Prefix increment.

◆ operator++() [2/2]

template<int N, class T >
JArrayIterator JTOOLS::JArrayIterator< N, T >::operator++ ( int )
inline

Postfix increment.

Returns
previous array sampler

Definition at line 81 of file JArrayIterator.hh.

82 {
83 const JArrayIterator previous(*this);
84
85 ++(*this);
86
87 return previous;
88 }

Member Data Documentation

◆ i

template<int N, class T >
int JTOOLS::JArrayIterator< N, T >::i
private

Definition at line 91 of file JArrayIterator.hh.


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