Skip to content

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

Closed
@Rotzbua

Description

@Rotzbua

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions