aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/WString.h
diff options
context:
space:
mode:
authorChristopher Andrews <chris@arduino.land>2014-07-13 22:55:53 +1000
committerCristian Maglie <c.maglie@arduino.cc>2016-04-20 16:07:52 +0200
commit0489fe3ae8f836d5e37415c2c72da4f923e5bb73 (patch)
tree7d505d44f01c7281d85a6b0cdc3ebb0b2f0412db /cores/arduino/WString.h
parent5e194bd8efe8dcd2fb6eaa13cec1a2a642c5254a (diff)
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 ); ```
Diffstat (limited to 'cores/arduino/WString.h')
-rw-r--r--cores/arduino/WString.h2
1 files changed, 2 insertions, 0 deletions
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)