summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>;