StringArray iterator and const_iterator typedef?


#1

I see StringArray got begin() and end() but don’t we need:

  typedef String* iterator;
  typedef String const* const_iterator;

in the declaration for class StringArray (and might want cbegin() and cend() for completeness) or else, it is not possible to write a generic function?


#2

Well, I was really just adding support for the new c++11 for loop syntax (which is awesome, BTW, if you’ve not tried it). That works nicely on a StringArray, const or not, and doesn’t need an iterator typedef.


#3

I would like to start using c++11 features. You’re right, the loop syntax kicks ass. In more than a few places in my code, I’ve had to split up loops onto multiple lines (due to verbosity). The auto keyword also obviates the iterator typedef.

Question is, how can I start using these features on Windows? I’m not on Visual Studio 20111 yet. What’s the c++11 support in Xcode? And Linux?


#4

The bits of private code where I’ve been able to use c++11 have been in Xcode with LLVM 3.0. And I’m pretty sure the latest GCC has most of the c++11 stuff now. Looking forward to the day when I can go through the codebase and start using some of these features.


#5

http://wiki.apache.org/stdcxx/C++0xCompilerSupport


#6

tl;dr version: MSVC sucks.