[Solved] c++ removing whitespace fails by using iterators

[ad_1]

Not only the commented line, but another will also fail if there is space in the begin of string.

First line fail (to compile) because string::find_first_not_of return size_t. And construct string from two size just make no sense.

Second line may fail because string::substr accept length (not end) as it’s second parameter.

1

[ad_2]

solved c++ removing whitespace fails by using iterators