From 8767aba6341f0bb9520510bacff56fe653fc7989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20S=C3=B8lvsten?= Date: Fri, 22 Sep 2023 14:43:24 -0400 Subject: [PATCH] Fix tpie::packed_array cannot compile with MSVC 19.28+ Microsoft's standard library assumes that a const version of tpie::packed_array::iterator and similar only are immutable with respect to the index, not the value in said index. That is, they assume the iterator reflects a 'T* const' semantics, whereas the prior version implemented a 'const T* const' semantics." --- tpie/packed_array.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tpie/packed_array.h b/tpie/packed_array.h index 327102631..7ffdb8845 100644 --- a/tpie/packed_array.h +++ b/tpie/packed_array.h @@ -300,10 +300,18 @@ class packed_array iter_return_type & operator*() { return elm; } + /////////////////////////////////////////////////////////////////////// + iter_return_type & operator*() const + { return const_cast(elm); } + /////////////////////////////////////////////////////////////////////// iter_return_type * operator->() { return &elm; } + /////////////////////////////////////////////////////////////////////// + iter_return_type * const operator->() const + { return &elm; } + /////////////////////////////////////////////////////////////////////// iter_base & operator=(const iter_base & o) {