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.
This commit is contained in:
parent
63e6354f70
commit
4839440364
|
@ -89,8 +89,6 @@ public:
|
||||||
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||||
String & operator = (String &&rval);
|
String & operator = (String &&rval);
|
||||||
String & operator = (StringSumHelper &&rval);
|
String & operator = (StringSumHelper &&rval);
|
||||||
auto begin() -> const char* { return c_str(); }
|
|
||||||
auto end() -> const char* { return c_str() + length(); }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// concatenate (works w/ built-in types)
|
// concatenate (works w/ built-in types)
|
||||||
|
@ -163,6 +161,8 @@ public:
|
||||||
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
|
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
|
||||||
{getBytes((unsigned char *)buf, bufsize, index);}
|
{getBytes((unsigned char *)buf, bufsize, index);}
|
||||||
const char * c_str() const { return buffer; }
|
const char * c_str() const { return buffer; }
|
||||||
|
const char* begin() { return c_str(); }
|
||||||
|
const char* end() { return c_str() + length(); }
|
||||||
|
|
||||||
// search
|
// search
|
||||||
int indexOf( char ch ) const;
|
int indexOf( char ch ) const;
|
||||||
|
|
Loading…
Reference in New Issue