mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
add features to std_allocator
This commit is contained in:
parent
f2a0ddb385
commit
9648793206
|
@ -131,6 +131,10 @@ void dealloc_svect(T * ptr) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct std_allocator {
|
struct std_allocator {
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
// the constructors must be proveded according to cpp docs
|
||||||
|
std_allocator() = default;
|
||||||
|
template <class U> constexpr std_allocator(const std_allocator<U>&) noexcept {}
|
||||||
|
|
||||||
|
|
||||||
T* allocate(std::size_t n) {
|
T* allocate(std::size_t n) {
|
||||||
return static_cast<T*>(memory::allocate(n * sizeof(T)));
|
return static_cast<T*>(memory::allocate(n * sizeof(T)));
|
||||||
|
@ -141,6 +145,12 @@ struct std_allocator {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// the comparison operators must be proveded according to cpp docs
|
||||||
|
template <class T, class U>
|
||||||
|
bool operator==(const std_allocator<T>&, const std_allocator<U>&) { return true; }
|
||||||
|
template <class T, class U>
|
||||||
|
bool operator!=(const std_allocator<T>&, const std_allocator<U>&) { return false; }
|
||||||
|
|
||||||
struct mem_stat {
|
struct mem_stat {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ Revision History:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class std_vector : public std::vector<T, std_allocator<T>> {};
|
using std_vector = std::vector<T, std_allocator<T>>;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue