blob: 2d91ff16a477ccce4c5f5a750752e07f3482c867 (
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;
auto operator++() noexcept -> MatrixRowIterator &;
auto operator++(int) noexcept -> MatrixRowIterator;
auto operator*() const noexcept -> Element &;
auto operator==(const MatrixRowIterator &rhs) const noexcept -> bool;
auto operator!=(const MatrixRowIterator &rhs) const noexcept -> bool;
private:
ColumnPtr _column_ptr;
};
template <typename Element>
class MatrixRow
{
public:
using RowPtr = gsl::owner<Element *>;
explicit MatrixRow(RowPtr row_ptr, const std::uint32_t &column_cnt) noexcept;
[[nodiscard]] auto begin() const noexcept -> MatrixRowIterator<Element>;
[[nodiscard]] auto end() const noexcept -> MatrixRowIterator<Element>;
private:
RowPtr _row_ptr;
const std::uint32_t &_column_cnt;
};
template <typename Element>
class MatrixIterator
{
public:
using RowPtr = gsl::owner<Element **>;
explicit MatrixIterator(RowPtr row_ptr, const std::uint32_t &column_cnt) noexcept;
auto operator++() noexcept -> MatrixIterator &;
auto operator++(int) noexcept -> MatrixIterator;
auto operator*() const noexcept -> MatrixRow<Element>;
auto operator==(const MatrixIterator &rhs) const noexcept -> bool;
auto operator!=(const MatrixIterator &rhs) const noexcept -> bool;
private:
RowPtr _row_ptr;
const std::uint32_t &_column_cnt;
};
#include "matrix_iterator_impl.hpp"
|