From 99d36fa7c2863d3eb3320162968fe4fd6e32db10 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 19 Aug 2022 15:25:32 +0200 Subject: [PATCH] smallvector.h: bake `reserve()` into the non-boost `SmallVector` implementation --- lib/smallvector.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/smallvector.h b/lib/smallvector.h index ed70e14c335..738e53dae90 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