Try to fix travis compilation errors

This commit is contained in:
Maxime Coste 2015-01-21 13:35:23 +00:00
parent 5383cece3e
commit b2d5b9ca5f
3 changed files with 11 additions and 6 deletions

View File

@ -132,7 +132,7 @@ bool operator!=(const Allocator<T1, d1>& lhs, const Allocator<T2, d2>& rhs)
template<typename T>
struct TypeDomain
{
static constexpr MemoryDomain domain = TypeDomain::helper((T*)nullptr);
static constexpr MemoryDomain domain() { return TypeDomain<T>::helper((T*)nullptr); }
private:
template<typename U> static decltype(U::Domain) constexpr helper(U*) { return U::Domain; }
static constexpr MemoryDomain helper(...) { return MemoryDomain::Undefined; }
@ -141,16 +141,21 @@ private:
template<MemoryDomain d>
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);
}
};

View File

@ -9,7 +9,7 @@
namespace Kakoune
{
template<typename Key, typename Value, MemoryDomain domain = TypeDomain<Key>::domain>
template<typename Key, typename Value, MemoryDomain domain = TypeDomain<Key>::domain()>
using UnorderedMap = std::unordered_map<Key, Value, Hash<Key>, std::equal_to<Key>,
Allocator<std::pair<const Key, Value>, domain>>;

View File

@ -8,7 +8,7 @@
namespace Kakoune
{
template<typename T, MemoryDomain domain = TypeDomain<T>::domain>
template<typename T, MemoryDomain domain = TypeDomain<T>::domain()>
using Vector = std::vector<T, Allocator<T, domain>>;
}