Skip to content

Commit 5abb905

Browse files
pfultz2firewave
authored andcommitted
smallvector.h: added custom allocator to regular SmallVector version
1 parent 6f55cab commit 5abb905

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/smallvector.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ using SmallVector = boost::container::small_vector<T, N>;
3131
#else
3232
#include <vector>
3333

34+
template<class T, std::size_t N>
35+
struct TaggedAllocator : std::allocator<T>
36+
{
37+
template<class ... Ts>
38+
TaggedAllocator(Ts&&... ts)
39+
: std::allocator<T>(std::forward<Ts>(ts)...)
40+
{}
41+
};
42+
3443
template<typename T, std::size_t N = DefaultSmallVectorSize>
35-
using SmallVector = std::vector<T>;
44+
using SmallVector = std::vector<T, TaggedAllocator<T, N>>;
3645
#endif
3746

3847
#endif

0 commit comments

Comments
 (0)