diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-17 02:03:30 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-17 02:03:30 +0000 |
commit | d75e737de182d11d0293212d6fd0fc2c6732af54 (patch) | |
tree | 9f5812908ab6dd2f6c084a1b568c9af3628b770e /lib/collections.hpp | |
parent | Update test/fixture/resource dependencies (diff) | |
download | ilt-d75e737de182d11d0293212d6fd0fc2c6732af54.tar.bz2 ilt-d75e737de182d11d0293212d6fd0fc2c6732af54.tar.xz ilt-d75e737de182d11d0293212d6fd0fc2c6732af54.zip |
Allow overriding vectorOfN's returned type
Diffstat (limited to 'lib/collections.hpp')
-rw-r--r-- | lib/collections.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp index 16870be..2b83500 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -92,11 +92,11 @@ operator+(const std::vector<T...> & in, Vn && vn) return out; } -template<template<typename> typename Direction = std::plus> +template<template<typename> typename Direction = std::plus, typename T = unsigned int> [[nodiscard]] static auto -vectorOfN(std::integral auto N, unsigned int start = {}, unsigned int step = 1) +vectorOfN(std::integral auto N, T start = {}, T step = 1) { - std::vector<unsigned int> v; + std::vector<T> v; v.resize(N); std::generate_n(v.begin(), N, [&start, step, adj = Direction {}]() { return std::exchange(start, adj(start, step)); |