diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-12 20:32:01 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-12 20:32:01 +0000 |
commit | 40f5a59dba7d5061821e143cebcfa30f6faa9464 (patch) | |
tree | c3a227216bbb23502f0df7c51e9c8fec2feeeeee /lib/collections.h | |
parent | Cast relative position accordingly in geometric plane (diff) | |
download | ilt-40f5a59dba7d5061821e143cebcfa30f6faa9464.tar.bz2 ilt-40f5a59dba7d5061821e143cebcfa30f6faa9464.tar.xz ilt-40f5a59dba7d5061821e143cebcfa30f6faa9464.zip |
Add materializeRange override for naked iterator pair
Diffstat (limited to 'lib/collections.h')
-rw-r--r-- | lib/collections.h | 13 |
1 files changed, 10 insertions, 3 deletions
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<template<typename...> typename Rtn = std::vector, typename In> +[[nodiscard]] auto +materializeRange(const In begin, const In end) +{ + return Rtn(begin, end); +} + template<template<typename...> typename Rtn = std::vector, IterableCollection In> [[nodiscard]] auto -materializeRange(In && in) +materializeRange(const In & in) { - return Rtn(in.begin(), in.end()); + return materializeRange<Rtn>(in.begin(), in.end()); } template<template<typename...> typename Rtn = std::vector, typename In> [[nodiscard]] auto materializeRange(const std::pair<In, In> & in) { - return Rtn(in.first, in.second); + return materializeRange<Rtn>(in.first, in.second); } template<typename T> struct pair_range { |