blob: 5d35052cceca9c69d7c2999ea00b3d19e626bb15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#pragma once
#include <gsl/pointers>
template <typename Element>
class MatrixRowIterator
{
public:
using ColumnPtr = gsl::owner<Element *>;
explicit MatrixRowIterator(ColumnPtr column_ptr) noexcept;
MatrixRowIterator &operator++() noexcept;
MatrixRowIterator operator++(int) noexcept;
Element &operator*() const noexcept;
bool operator==(const MatrixRowIterator &rhs) const noexcept;
bool operator!=(const MatrixRowIterator &rhs) const noexcept;
private:
ColumnPtr _column_ptr;
};
template <typename Element>
class MatrixRow
{
public:
using RowPtr = gsl::owner<Element *>;
explicit MatrixRow(RowPtr row_ptr, const uint32_t &column_cnt) noexcept;
[[nodiscard]] MatrixRowIterator<Element> begin() const noexcept;
[[nodiscard]] MatrixRowIterator<Element> end() const noexcept;
private:
RowPtr _row_ptr;
const uint32_t &_column_cnt;
};
template <typename Element>
class MatrixIterator
{
public:
using RowPtr = gsl::owner<Element **>;
explicit MatrixIterator(RowPtr row_ptr, const uint32_t &column_cnt) noexcept;
MatrixIterator &operator++() noexcept;
MatrixIterator operator++(int) noexcept;
MatrixRow<Element> operator*() const noexcept;
bool operator==(const MatrixIterator &rhs) const noexcept;
bool operator!=(const MatrixIterator &rhs) const noexcept;
private:
RowPtr _row_ptr;
const uint32_t &_column_cnt;
};
#include "matrix_iterator.tpp"
|