Skip to content

Commit 500a3fd

Browse files
Chris--Acmaglie
authored andcommitted
Removed C++11 dependency for begin() and end()
As I was not able to base the return types of `begin()` & `end()` off the c_str() function, I have changed the source so the features can be used by C++98 code, while still allowing ranged loops in C++11.
1 parent 8e385bf commit 500a3fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: hardware/arduino/avr/cores/arduino/WString.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ class String
8989
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
9090
String & operator = (String &&rval);
9191
String & operator = (StringSumHelper &&rval);
92-
auto begin() -> const char* { return c_str(); }
93-
auto end() -> const char* { return c_str() + length(); }
9492
#endif
9593

9694
// concatenate (works w/ built-in types)
@@ -163,6 +161,8 @@ class String
163161
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
164162
{getBytes((unsigned char *)buf, bufsize, index);}
165163
const char * c_str() const { return buffer; }
164+
const char* begin() { return c_str(); }
165+
const char* end() { return c_str() + length(); }
166166

167167
// search
168168
int indexOf( char ch ) const;

0 commit comments

Comments
 (0)