Skip to content

WString.h: Add const qualifier to begin and end functions #4945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modified begin() & end() for read/write
begin() and end() only allowed read access, these changes now allow both.
  • Loading branch information
Chris--A committed May 12, 2016
commit ce5d5717aa3f77c18041719fc92b3f03db588295
6 changes: 4 additions & 2 deletions hardware/arduino/sam/cores/arduino/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ 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(); }
char* begin() { return buffer; }
char* end() { return buffer + length(); }
const char* begin() const { return c_str(); }
const char* end() const { return c_str() + length(); }

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