From eb4e75f8c3b52c1a648c8af7febd94e83b0af657 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Mar 2023 00:28:24 +0100 Subject: [PATCH] Document that range for can be used for wxString iteration This is simpler and better than using iterators. --- docs/doxygen/overviews/string.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/doxygen/overviews/string.h b/docs/doxygen/overviews/string.h index 569411b16b..1d92ec1929 100644 --- a/docs/doxygen/overviews/string.h +++ b/docs/doxygen/overviews/string.h @@ -296,6 +296,18 @@ for (i = s.begin(); i != s.end(); ++i) } @endcode +or, even simpler, range for loop: +@code +wxString s = "hello"; +for ( auto c : s ) +{ + // do something with "c" +} +@endcode + +@note wxString iterators have unusual proxy-like semantics and can be used to + modify the string even when @e not using references, i.e. with just @c + auto, as in the example above. @section overview_string_related String Related Functions and Classes