From 0489fe3ae8f836d5e37415c2c72da4f923e5bb73 Mon Sep 17 00:00:00 2001 From: Christopher Andrews Date: Sun, 13 Jul 2014 22:55:53 +1000 Subject: [PATCH] Updated String library to use C++11 iterators. This will allow using the String library in a ranged for loop: ```C++ String s = "Hi, this is a test"; for( char c : s ) Serial.print( c ); ``` --- cores/arduino/WString.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index b047980..4667a0d 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -89,6 +89,8 @@ public: #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) String & operator = (String &&rval); String & operator = (StringSumHelper &&rval); + auto begin() -> const char* { return c_str(); } + auto end() -> const char* { return c_str() + length(); } #endif // concatenate (works w/ built-in types)