From 84969ba00d67aac809e171c7e10a250eeff285a6 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Sat, 27 Aug 2016 18:51:37 +0300 Subject: [PATCH] Prevent assignment to wxString::const_iterator from compiling Make const_reference const and dereference const_iterator into a const_reference to ensure that the code trying to assign to a (dereferenced) const_iterator doesn't compile. Closes https://github.com/wxWidgets/wxWidgets/pull/316 --- include/wx/string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 0d9fc48ecb..7b39add2b1 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -702,7 +702,7 @@ public: typedef const wxChar* const_pointer; typedef size_t size_type; - typedef wxUniChar const_reference; + typedef const wxUniChar const_reference; #if wxUSE_STD_STRING #if wxUSE_UNICODE_UTF8 @@ -951,7 +951,7 @@ public: const_iterator(const const_iterator& i) : m_cur(i.m_cur) {} const_iterator(const iterator& i) : m_cur(i.m_cur) {} - reference operator*() const + const_reference operator*() const { return wxStringOperations::DecodeChar(m_cur); } const_iterator operator+(ptrdiff_t n) const