Skip to content

Commit

Permalink
Removed C++11 dependency for begin() and end()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris--A authored and cmaglie committed Apr 20, 2016
1 parent 8e385bf commit 500a3fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hardware/arduino/avr/cores/arduino/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class String
#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)
Expand Down Expand Up @@ -163,6 +161,8 @@ class String
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
{getBytes((unsigned char *)buf, bufsize, index);}
const char * c_str() const { return buffer; }
const char* begin() { return c_str(); }
const char* end() { return c_str() + length(); }

// search
int indexOf( char ch ) const;
Expand Down

0 comments on commit 500a3fd

Please sign in to comment.