Skip to content
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

WString.h is not compatible to c++11 range-based loop #4837

Closed
Rotzbua opened this issue Apr 8, 2016 · 3 comments
Closed

WString.h is not compatible to c++11 range-based loop #4837

Rotzbua opened this issue Apr 8, 2016 · 3 comments
Milestone

Comments

@Rotzbua
Copy link
Contributor

Rotzbua commented Apr 8, 2016

I tried to use the new c++11 syntax with the default string class from arduino. Actually it fails because it has no begin or end.

Test-IDE: 1.6.8 (Win8.1 x64)
Board: Uno

Example code:

String temp = "abc";
for (auto tempchar : temp) {
    Serial.println(tempchar);
}

Error:

error: 'begin' was not declared in this scope
for (auto tempchar : temp) {
error: 'end' was not declared in this scope

Reference:
http://en.cppreference.com/w/cpp/language/range-for

Best

@NicoHood
Copy link
Contributor

NicoHood commented Apr 8, 2016

This was already "discussed" somewhere else. No answer as I remember. I also suggest to add this feature.

@Chris--A
Copy link
Contributor

Chris--A commented Apr 9, 2016

I have a PR hanging around: #2179

I proposed this before C++11 was enabled (2014).
Would be nice to see this finally merged.

While we're on the subject of the String class: #3096...

@cmaglie cmaglie added this to the Release 1.6.9 milestone Apr 20, 2016
@cmaglie
Copy link
Member

cmaglie commented Apr 20, 2016

Fixed with #2179

@cmaglie cmaglie closed this as completed Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants