[cfe-dev] c++11 and invalid opcode

Sean Silva silvas at purdue.edu
Sun Feb 3 17:01:51 PST 2013


> Your flip() function is causing undefined behaviour, as string::end()
> returns an iterator to the character *following* the last character of
> the string.  Dereferencing that iterator is not allowed, you can only
> compare it against other iterators.

Where exactly does it dereference the off-the-end iterator?
std::reverse takes a half-open range.

-- Sean Silva



More information about the cfe-dev mailing list