summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-07 23:47:26 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-07 23:50:43 +0100
commitb244b896503065198bc736bbff52d6ff79c24986 (patch)
tree3cff9379be9bd151dddb762b11335ae5bb2f5250 /lib
parentApply styles in first loop over controlled faces (diff)
downloadilt-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')
-rw-r--r--lib/collections.hpp15
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>;