Change stringstream::swap with stringstream::str.