mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 11:34:38 +03:00
add missing members to stl allocator (#193)
This commit is contained in:
parent
b77be05e40
commit
146899af8a
3 changed files with 56 additions and 19 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <mimalloc.h>
|
||||
#include <new>
|
||||
#include <vector>
|
||||
|
||||
static void* p = malloc(8);
|
||||
|
||||
|
@ -69,3 +70,18 @@ public:
|
|||
static Static s = Static();
|
||||
|
||||
|
||||
bool test_stl_allocator1() {
|
||||
std::vector<int, mi_stl_allocator<int>> vec;
|
||||
vec.push_back(1);
|
||||
vec.pop_back();
|
||||
return vec.size() == 0;
|
||||
}
|
||||
|
||||
bool test_stl_allocator2() {
|
||||
struct some_struct { int i; int j; double z; };
|
||||
|
||||
std::vector<some_struct, mi_stl_allocator<some_struct>> vec;
|
||||
vec.push_back(some_struct());
|
||||
vec.pop_back();
|
||||
return vec.size() == 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue