AlgoPlus v0.1.0
Loading...
Searching...
No Matches
Mat2d< T, ROWS, COLS >::Iterator Class Reference

Iterator for Mat2d class. More...

#include <mat_2d.h>

Public Types

typedef T * iterator
 

Public Member Functions

 Iterator (T *_arr, size_t rows, size_t cols, size_t index) noexcept
 constructor for Iterator class
 
Iteratoroperator= (T *curr)
 operator = for Iterator class
 
Iteratoroperator++ ()
 operator ++ for Iterator class
 
Iteratoroperator++ (int)
 
Iteratoroperator-- ()
 operator – for Iterator class
 
Iteratoroperator-- (int)
 operator – for Iterator class
 
bool operator!= (const Iterator &it)
 operator != for Iterator class
 
template<typename A, size_t CCOLS>
Mat1d< A, CCOLS > & operator* ()
 operator * for Iterator class
 
 Mat2d (std::vector< std::vector< T > > v={})
 constructor for Mat2d class
 
 Mat2d (const T val) noexcept
 constructor for Mat2d class with initializer value
 
 Mat2d (const Mat2d &mat)
 copy constructor for Mat2d class
 
Mat2doperator= (Mat2d &mat)
 operator = for Mat2d class
 
T & operator() (size_t i, size_t j) const
 operator (i, j) for Mat2d class
 
Mat1d< T, COLS > & operator() (size_t i)
 operator () for Mat2d class
 
size_t size () const
 size function
 
size_t cols () const
 cols function
 
size_t rows () const
 rows function
 
Iterator begin ()
 begin() Iterator for Mat2d class
 
Iterator end ()
 end() Iterator for Mat2d class
 

Friends

std::ostream & operator<< (std::ostream &out, Mat2d &mat)
 operator << for Mat2d class
 

Detailed Description

template<typename T, size_t ROWS, size_t COLS>
class Mat2d< T, ROWS, COLS >::Iterator

Iterator for Mat2d class.

Constructor & Destructor Documentation

◆ Iterator()

template<typename T, size_t ROWS, size_t COLS>
Mat2d< T, ROWS, COLS >::Iterator::Iterator ( T * _arr,
size_t rows,
size_t cols,
size_t index )
inlineexplicitnoexcept

constructor for Iterator class

Parameters
__arrthe input array
rowsthe number of rows of the matrix
colsthe number of columns of the matrix
indexthe current index, if it's begin() then 0, if it's end() then __size

Member Function Documentation

◆ begin()

Iterator Mat2d< T, ROWS, COLS >::begin ( )
inline

begin() Iterator for Mat2d class

Returns
Iterator

◆ cols()

size_t Mat2d< T, ROWS, COLS >::cols ( ) const
inline

cols function

Returns
size_t the number of elements in each column

◆ end()

Iterator Mat2d< T, ROWS, COLS >::end ( )
inline

end() Iterator for Mat2d class

Returns
Iterator

◆ Mat2d() [1/2]

Mat2d< T, ROWS, COLS >::Mat2d ( const Mat2d & mat)
inlineexplicit

copy constructor for Mat2d class

Parameters
matthe 2d matrix we want to copy

◆ Mat2d() [2/2]

Mat2d< T, ROWS, COLS >::Mat2d ( const T val)
inlineexplicitnoexcept

constructor for Mat2d class with initializer value

Parameters
valthe value that we want all the index of the array to have

◆ operator!=()

template<typename T, size_t ROWS, size_t COLS>
bool Mat2d< T, ROWS, COLS >::Iterator::operator!= ( const Iterator & it)
inline

operator != for Iterator class

Returns
true if the elements of the array in the current index is not equal
false otherwise

◆ operator()() [1/2]

Mat1d< T, COLS > & Mat2d< T, ROWS, COLS >::operator() ( size_t i)
inline

operator () for Mat2d class

Parameters
iindex that's pointing to the row
Returns
std::vector<T> the array of index i

◆ operator()() [2/2]

T & Mat2d< T, ROWS, COLS >::operator() ( size_t i,
size_t j ) const
inline

operator (i, j) for Mat2d class

Parameters
iindex that's pointing to the row
jindex that's pointing to the column
Returns
T the element of arr[i][j]

◆ operator*()

template<typename T, size_t ROWS, size_t COLS>
template<typename A, size_t CCOLS>
Mat1d< A, CCOLS > & Mat2d< T, ROWS, COLS >::Iterator::operator* ( )
inline

operator * for Iterator class

Returns
Mat1d<T, COLS> the 1-Dimensional Matrix in the current row

◆ operator++() [1/2]

template<typename T, size_t ROWS, size_t COLS>
Iterator & Mat2d< T, ROWS, COLS >::Iterator::operator++ ( )
inline

operator ++ for Iterator class

Returns
Iterator&

◆ operator++() [2/2]

template<typename T, size_t ROWS, size_t COLS>
Iterator & Mat2d< T, ROWS, COLS >::Iterator::operator++ ( int )
inline
Parameters
operator++ for Iterator class
Returns
Iterator&

◆ operator--() [1/2]

template<typename T, size_t ROWS, size_t COLS>
Iterator & Mat2d< T, ROWS, COLS >::Iterator::operator-- ( )
inline

operator – for Iterator class

Returns
Iterator&

◆ operator--() [2/2]

template<typename T, size_t ROWS, size_t COLS>
Iterator & Mat2d< T, ROWS, COLS >::Iterator::operator-- ( int )
inline

operator – for Iterator class

Returns
Iterator&

◆ operator=() [1/2]

Mat2d & Mat2d< T, ROWS, COLS >::operator= ( Mat2d & mat)
inline

operator = for Mat2d class

Parameters
matthe matrix we want to copy
Returns
Mat2d&

◆ operator=() [2/2]

template<typename T, size_t ROWS, size_t COLS>
Iterator & Mat2d< T, ROWS, COLS >::Iterator::operator= ( T * curr)
inline

operator = for Iterator class

Parameters
currthe current array
Returns
Iterator&

◆ rows()

size_t Mat2d< T, ROWS, COLS >::rows ( ) const
inline

rows function

Returns
size_t the number of elements in each row

◆ size()

size_t Mat2d< T, ROWS, COLS >::size ( ) const
inline

size function

Returns
size_t the size of the matrix

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