Why not just use std::stringstream?