Add a note about using ranged-based for loop with wxString
It is surprising that "for (auto& c: s)" doesn't compile, so document this and propose a replacement. Do not document the fact that "for (auto c: s)" actually allows to modify the string via "c" (which is still wxUniCharRef) as this is probably just going to confuse people more than help.
This commit is contained in:
parent
c5ab151a72
commit
cf2bb21885
@ -255,6 +255,11 @@ n:
|
||||
string iterators instead if possible or replace this expression with
|
||||
@code s.c_str() + n @endcode otherwise.
|
||||
|
||||
- When using C++11 range-based for loop, the natural construct for iterating
|
||||
over wxString @code for ( auto& ch: s ) @endcode doesn't compile because of
|
||||
the unusual iterator type and @code for ( wxUniCharRef ch: s ) @endcode
|
||||
needs to be used instead.
|
||||
|
||||
Another class of problems is related to the fact that the value returned by
|
||||
@c c_str() itself is also not just a pointer to a buffer but a value of helper
|
||||
class wxCStrData which is implicitly convertible to both narrow and wide
|
||||
|
Loading…
Reference in New Issue
Block a user