By adding in an iterator for stream reading, the two step process of checking for available data, and reading the character can become a single operation.
StreamEx s = Serial;
for( char c : s ){
//got char 'c'
}
This would be the equivalent to:
int current;
while( (current = Serial.read()) != -1 ){
//do something with current.
}
By adding in an iterator for stream reading, the two step process of checking for available data, and reading the character can become a single operation.
This would be the equivalent to: