From 2afd5f80e791e9d35f9eb49c2d99015492e7619a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 20 Aug 2022 20:44:26 +0200 Subject: [PATCH] smallvector.h: bake `reserve()` into the non-boost `SmallVector` implementation (#4385) --- lib/smallvector.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/smallvector.h b/lib/smallvector.h index ed70e14c3..738e53dae 100644 --- a/lib/smallvector.h +++ b/lib/smallvector.h @@ -42,7 +42,16 @@ struct TaggedAllocator : std::allocator }; template -using SmallVector = std::vector>; +class SmallVector : public std::vector> +{ +public: + template + SmallVector(Ts&&... ts) + : std::vector>(std::forward(ts)...) + { + this->reserve(N); + } +}; #endif #endif