From: Carl Hetherington Date: Sun, 6 Nov 2022 20:50:54 +0000 (+0100) Subject: Add EnumIndexedVector::indices(). X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f39edbf3a783c2e1feb830829c3815524428b03a Add EnumIndexedVector::indices(). --- 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 indices() const { + if (_indices.empty()) { + for (int i = 0; i < static_cast(Enum::COUNT); ++i) { + _indices.push_back(static_cast(i)); + } + } + return _indices; + } + private: std::vector _data; + mutable std::vector _indices; };