Fix C++20 compilation
Several std::allocator<> members were deprecated in C++17 and
subsequently removed in C++20. Drop deprecated members altogether since
these are unused anyway.
Change-Id: Ic26471a4b1cb3ccc1fdf3231400c81827b0ff712
diff --git a/internal/ceres/fixed_array_test.cc b/internal/ceres/fixed_array_test.cc
index d418786..f29f809 100644
--- a/internal/ceres/fixed_array_test.cc
+++ b/internal/ceres/fixed_array_test.cc
@@ -655,7 +655,6 @@
class CountingAllocator : public std::allocator<T> {
public:
using Alloc = std::allocator<T>;
- using pointer = typename Alloc::pointer;
using size_type = typename Alloc::size_type;
CountingAllocator() : bytes_used_(nullptr), instance_count_(nullptr) {}
@@ -670,39 +669,18 @@
bytes_used_(x.bytes_used_),
instance_count_(x.instance_count_) {}
- pointer allocate(size_type n, const void* const hint = nullptr) {
+ T* allocate(size_type n) {
assert(bytes_used_ != nullptr);
*bytes_used_ += n * sizeof(T);
- return Alloc::allocate(n, hint);
+ return Alloc::allocate(n);
}
- void deallocate(pointer p, size_type n) {
+ void deallocate(T* p, size_type n) {
Alloc::deallocate(p, n);
assert(bytes_used_ != nullptr);
*bytes_used_ -= n * sizeof(T);
}
- template <typename... Args>
- void construct(pointer p, Args&&... args) {
- Alloc::construct(p, std::forward<Args>(args)...);
- if (instance_count_) {
- *instance_count_ += 1;
- }
- }
-
- void destroy(pointer p) {
- Alloc::destroy(p);
- if (instance_count_) {
- *instance_count_ -= 1;
- }
- }
-
- template <typename U>
- class rebind {
- public:
- using other = CountingAllocator<U>;
- };
-
int64_t* bytes_used_;
int64_t* instance_count_;
};