Replace type aliases deprecated/removed in C++17/C++20 from FixedArray
- Raised as issue #551
- Also adds C++20 to the set of ALLOWED_CXX_STANDARDS, although this
will require a version of CMake >= 3.12.
Change-Id: I0f13c72e93a35391fd2d18590b4243a329a2322c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7de7d37..5a0de03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,7 @@
"C++ standard (minimum 11)" FORCE)
# Restrict CMAKE_CXX_STANDARD to the valid versions permitted and ensure that
# if one was forced via -D that it is in the valid set.
-set(ALLOWED_CXX_STANDARDS 11 14 17)
+set(ALLOWED_CXX_STANDARDS 11 14 17 20)
set_property(CACHE CMAKE_CXX_STANDARD PROPERTY STRINGS ${ALLOWED_CXX_STANDARDS})
list(FIND ALLOWED_CXX_STANDARDS ${CMAKE_CXX_STANDARD} POSITION)
if (POSITION LESS 0)
diff --git a/include/ceres/internal/fixed_array.h b/include/ceres/internal/fixed_array.h
index 15481f3..021851d 100644
--- a/include/ceres/internal/fixed_array.h
+++ b/include/ceres/internal/fixed_array.h
@@ -105,13 +105,13 @@
public:
using allocator_type = typename AllocatorTraits::allocator_type;
- using value_type = typename allocator_type::value_type;
- using pointer = typename allocator_type::pointer;
- using const_pointer = typename allocator_type::const_pointer;
- using reference = typename allocator_type::reference;
- using const_reference = typename allocator_type::const_reference;
- using size_type = typename allocator_type::size_type;
- using difference_type = typename allocator_type::difference_type;
+ using value_type = typename AllocatorTraits::value_type;
+ using pointer = typename AllocatorTraits::pointer;
+ using const_pointer = typename AllocatorTraits::const_pointer;
+ using reference = value_type&;
+ using const_reference = const value_type&;
+ using size_type = typename AllocatorTraits::size_type;
+ using difference_type = typename AllocatorTraits::difference_type;
using iterator = pointer;
using const_iterator = const_pointer;
using reverse_iterator = std::reverse_iterator<iterator>;