Skip to content
Snippets Groups Projects
Commit 16f7e4e9 authored by Jö Fahlke's avatar Jö Fahlke
Browse files

Implement allocator comparison.

See https://en.cppreference.com/w/cpp/concept/Allocator.  This is required to
use `AlignedAllocator` in a `std::vector`.
parent 88c6b64b
Branches
Tags
1 merge request!494Implement allocator comparison.
Pipeline #
......@@ -303,6 +303,22 @@ namespace Dune
p->~T();
}
};
//! check whether allocators are equivalent
template<class T>
constexpr bool
operator==(const DebugAllocator<T> &, const DebugAllocator<T> &)
{
return true;
}
//! check whether allocators are not equivalent
template<class T>
constexpr bool
operator!=(const DebugAllocator<T> &, const DebugAllocator<T> &)
{
return false;
}
}
#ifdef DEBUG_NEW_DELETE
......
......@@ -96,6 +96,22 @@ namespace Dune
p->~T();
}
};
//! check whether allocators are equivalent
template<class T>
constexpr bool
operator==(const MallocAllocator<T> &, const MallocAllocator<T> &)
{
return true;
}
//! check whether allocators are not equivalent
template<class T>
constexpr bool
operator!=(const MallocAllocator<T> &, const MallocAllocator<T> &)
{
return false;
}
}
#endif // DUNE_MALLOC_ALLOCATOR_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment