added rebind copy-ctor to STLAllocator
this should fix the build on windows debug
This commit is contained in:
committed by
Mathias Agopian
parent
0bdb6b8a8a
commit
8bdae79536
@@ -739,6 +739,9 @@ public:
|
||||
// from an Arena, avoiding to have to repeat the vector type.
|
||||
STLAllocator(ARENA& arena) : mArena(arena) { } // NOLINT(google-explicit-constructor)
|
||||
|
||||
template<typename U>
|
||||
explicit STLAllocator(STLAllocator<U, ARENA> const& rhs) : mArena(rhs.mArena) { }
|
||||
|
||||
TYPE* allocate(std::size_t n) {
|
||||
return static_cast<TYPE *>(mArena.alloc(n * sizeof(TYPE), alignof(TYPE)));
|
||||
}
|
||||
|
||||
@@ -308,6 +308,16 @@ TEST(AllocatorTest, STLAllocator) {
|
||||
EXPECT_TRUE(allocator != allocator2);
|
||||
EXPECT_TRUE(allocator == allocator);
|
||||
|
||||
STLAllocator<int, Arena>::rebind<char>::other charAllocator(arena);
|
||||
EXPECT_TRUE(allocator == charAllocator);
|
||||
|
||||
STLAllocator<int, Arena> allocatorCopy(allocator);
|
||||
EXPECT_TRUE(allocator == allocatorCopy);
|
||||
|
||||
STLAllocator<int, Arena> allocatorFromCharCopy(charAllocator);
|
||||
EXPECT_TRUE(allocatorFromCharCopy == charAllocator);
|
||||
|
||||
|
||||
{
|
||||
#if !defined(WIN32)
|
||||
std::vector<int, STLAllocator<int, Arena>> vector(allocator);
|
||||
|
||||
Reference in New Issue
Block a user