diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/collections.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp index 4df622e..b51d18e 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -70,6 +70,9 @@ template<template<typename...> typename C, typename... T> operator*(const C<T...> & in, auto && f) { C<decltype(f(*in.begin()))> out; + if constexpr (requires { out.reserve(in.size()); }) { + out.reserve(in.size()); + } std::transform(in.begin(), in.end(), std::inserter(out, out.end()), f); return out; |