Remove redundant types inside Kakoune::Allocator

This commit is contained in:
Maxime Coste 2017-08-12 15:49:38 +07:00
parent a61c51dfc6
commit 407c84666c

View File

@ -89,13 +89,6 @@ template<typename T, MemoryDomain domain>
struct Allocator struct Allocator
{ {
using value_type = T; using value_type = T;
// TODO: remove that once we have a c++11 compliant stdlib
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
Allocator() = default; Allocator() = default;
template<typename U> template<typename U>
@ -117,27 +110,16 @@ struct Allocator
on_dealloc(domain, size); on_dealloc(domain, size);
::operator delete(ptr); ::operator delete(ptr);
} }
template<class U, class... Args>
[[gnu::always_inline]]
void construct(U* p, Args&&... args)
{
new ((void*)p) U(std::forward<Args>(args)...);
}
template<class U>
[[gnu::always_inline]]
void destroy(U* p) { p->~U(); }
}; };
template<typename T1, MemoryDomain d1, typename T2, MemoryDomain d2> template<typename T1, MemoryDomain d1, typename T2, MemoryDomain d2>
bool operator==(const Allocator<T1, d1>& lhs, const Allocator<T2, d2>& rhs) constexpr bool operator==(const Allocator<T1, d1>&, const Allocator<T2, d2>&)
{ {
return d1 == d2; return d1 == d2;
} }
template<typename T1, MemoryDomain d1, typename T2, MemoryDomain d2> template<typename T1, MemoryDomain d1, typename T2, MemoryDomain d2>
bool operator!=(const Allocator<T1, d1>& lhs, const Allocator<T2, d2>& rhs) constexpr bool operator!=(const Allocator<T1, d1>&, const Allocator<T2, d2>&)
{ {
return d1 != d2; return d1 != d2;
} }