From 40f5a59dba7d5061821e143cebcfa30f6faa9464 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 12 Feb 2024 20:32:01 +0000 Subject: Add materializeRange override for naked iterator pair --- lib/collections.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/collections.h b/lib/collections.h index 6cee10c..dd603be 100644 --- a/lib/collections.h +++ b/lib/collections.h @@ -130,18 +130,25 @@ vectorOfN(std::integral auto N, T start = {}, T step = 1) return v; } +template typename Rtn = std::vector, typename In> +[[nodiscard]] auto +materializeRange(const In begin, const In end) +{ + return Rtn(begin, end); +} + template typename Rtn = std::vector, IterableCollection In> [[nodiscard]] auto -materializeRange(In && in) +materializeRange(const In & in) { - return Rtn(in.begin(), in.end()); + return materializeRange(in.begin(), in.end()); } template typename Rtn = std::vector, typename In> [[nodiscard]] auto materializeRange(const std::pair & in) { - return Rtn(in.first, in.second); + return materializeRange(in.first, in.second); } template struct pair_range { -- cgit v1.2.3