modify the to_string() method to using ostringstream.