strstream::rdbuf has the same issue with a missing const_cast on &sb.
Somewhat amusingly, istrstream::rdbuf and ostrstream::rdbuf got this right, but each with a different style (see issue 252).