diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-07 23:47:26 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-07 23:50:43 +0100 |
commit | b244b896503065198bc736bbff52d6ff79c24986 (patch) | |
tree | 3cff9379be9bd151dddb762b11335ae5bb2f5250 /lib/collections.hpp | |
parent | Apply styles in first loop over controlled faces (diff) | |
download | ilt-b244b896503065198bc736bbff52d6ff79c24986.tar.bz2 ilt-b244b896503065198bc736bbff52d6ff79c24986.tar.xz ilt-b244b896503065198bc736bbff52d6ff79c24986.zip |
Add helper for iterating over a range defined by a pair of iterators
Diffstat (limited to 'lib/collections.hpp')
-rw-r--r-- | lib/collections.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp index 2b83500..59cec6f 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -117,3 +117,18 @@ materializeRange(const std::pair<In, In> & in) { return Rtn(in.first, in.second); } + +template<typename T> struct pair_range { + constexpr auto & + begin() const noexcept + { + return pair.first; + } + constexpr auto & + end() const noexcept + { + return pair.second; + } + const std::pair<T, T> & pair; +}; +template<typename T> pair_range(std::pair<T, T>) -> pair_range<T>; |