-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathRowColIterator.h
More file actions
39 lines (32 loc) · 837 Bytes
/
RowColIterator.h
File metadata and controls
39 lines (32 loc) · 837 Bytes
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
/*
*
* Makes rows and colomns of LedMatrix iterable
* Helper class.
*
* @author Valeriy V Dmitriev aka valmat <ufabiz@gmail.com>, http://valmat.ru/
* @licenses MIT https://opensource.org/licenses/MIT
* @repo https://github.com/valmat/LedMatrix
*
*/
#pragma once
#include "RowCol.h"
template<uint8_t maxRows, bool isRow>
struct RowColIterator {
// Constructor
constexpr RowColIterator() {}
constexpr uint8_t size() const
{
return maxRows;
}
// Make iterable
constexpr RowCol<maxRows, isRow> begin() const
{
return RowCol<maxRows, isRow>(0, true);
}
constexpr RowCol<maxRows, isRow> end() const
{
return RowCol<maxRows, isRow>(maxRows, false);
}
};
using RowsIterator = RowColIterator<8, true>;
using ColsIterator = RowColIterator<8, false>;