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 );
```
This commit is contained in:
Christopher Andrews 2014-07-13 22:55:53 +10:00 committed by Cristian Maglie
parent 5e194bd8ef
commit 0489fe3ae8
1 changed files with 2 additions and 0 deletions

View File

@ -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)