You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
507 B
24 lines
507 B
#pragma once
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <list>
|
|
|
|
#include <mimalloc.h>
|
|
|
|
template <typename T>
|
|
using stl_vector_mp = std::vector<T, mi_stl_allocator<T>>;
|
|
|
|
template <typename T>
|
|
using stl_list_mp = std::list<T, mi_stl_allocator<T>>;
|
|
|
|
template <typename T>
|
|
struct mi_stl_deleter {
|
|
void operator()(T* p) const { mi_free(p); }
|
|
};
|
|
|
|
template <typename T>
|
|
static inline std::shared_ptr<T> make_shared_mp()
|
|
{
|
|
return std::shared_ptr<T>(new (mi_malloc(sizeof(T))) T(), mi_stl_deleter<T>());
|
|
}
|