clear() clears the error status flags in stringstream . That is, it sets the error state to goodbit (which is zero).
str("") sets the associated string object to an empty string.
They actually do completely different things. The unusual choice of names only makes it sound like they are performing similar tasks.
Alfazulu
source share