diff --git a/src/memory.hh b/src/memory.hh index 163dd76c..3c45f392 100644 --- a/src/memory.hh +++ b/src/memory.hh @@ -132,7 +132,7 @@ bool operator!=(const Allocator& lhs, const Allocator& rhs) template struct TypeDomain { - static constexpr MemoryDomain domain = TypeDomain::helper((T*)nullptr); + static constexpr MemoryDomain domain() { return TypeDomain::helper((T*)nullptr); } private: template static decltype(U::Domain) constexpr helper(U*) { return U::Domain; } static constexpr MemoryDomain helper(...) { return MemoryDomain::Undefined; } @@ -141,16 +141,21 @@ private: template struct UseMemoryDomain { - static constexpr MemoryDomain domain = d; + static constexpr MemoryDomain Domain = d; static void* operator new(size_t size) { - on_alloc(domain, size); + on_alloc(Domain, size); return ::operator new(size); } + static void* operator new(size_t size, void* ptr) + { + return ::operator new(size, ptr); + } + static void operator delete(void* ptr, size_t size) { - on_dealloc(domain, size); + on_dealloc(Domain, size); ::operator delete(ptr); } }; diff --git a/src/unordered_map.hh b/src/unordered_map.hh index 2c54a0da..13246fac 100644 --- a/src/unordered_map.hh +++ b/src/unordered_map.hh @@ -9,7 +9,7 @@ namespace Kakoune { -template::domain> +template::domain()> using UnorderedMap = std::unordered_map, std::equal_to, Allocator, domain>>; diff --git a/src/vector.hh b/src/vector.hh index db137b24..c8cc9d08 100644 --- a/src/vector.hh +++ b/src/vector.hh @@ -8,7 +8,7 @@ namespace Kakoune { -template::domain> +template::domain()> using Vector = std::vector>; }