diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-11-06 21:50:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-12-09 00:05:00 +0100 |
| commit | ecab373f1fe520441b0234378615b61e4016387b (patch) | |
| tree | b533eb46b553ed93515613da9f1e63d61853336c /src | |
| parent | 5c53a0ac655eeaeb07116ad30ca8e1dadefe4ca2 (diff) | |
Add EnumIndexedVector::indices().
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/enum_indexed_vector.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/enum_indexed_vector.h b/src/lib/enum_indexed_vector.h index 0187daba2..ee34575ea 100644 --- a/src/lib/enum_indexed_vector.h +++ b/src/lib/enum_indexed_vector.h @@ -70,8 +70,18 @@ public: return _data.end(); } + std::vector<Enum> indices() const { + if (_indices.empty()) { + for (int i = 0; i < static_cast<int>(Enum::COUNT); ++i) { + _indices.push_back(static_cast<Enum>(i)); + } + } + return _indices; + } + private: std::vector<Type> _data; + mutable std::vector<Enum> _indices; }; |
