smallvector.h: bake `reserve()` into the non-boost `SmallVector` implementation (#4385)
This commit is contained in:
parent
5cc8ef7e87
commit
2afd5f80e7
|
@ -42,7 +42,16 @@ struct TaggedAllocator : std::allocator<T>
|
|||
};
|
||||
|
||||
template<typename T, std::size_t N = DefaultSmallVectorSize>
|
||||
using SmallVector = std::vector<T, TaggedAllocator<T, N>>;
|
||||
class SmallVector : public std::vector<T, TaggedAllocator<T, N>>
|
||||
{
|
||||
public:
|
||||
template<class ... Ts>
|
||||
SmallVector(Ts&&... ts)
|
||||
: std::vector<T, TaggedAllocator<T, N>>(std::forward<Ts>(ts)...)
|
||||
{
|
||||
this->reserve(N);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue