Sorry for the off-topic question but:

What is the correct way to empty a stringstream to use it again? Currently, 
I'm using ss.str(string()) but I'm sure there must be a better way...

        std::stringstream ss;

        // fill it the first time
        ss << "attempt 1";
        std::cerr << ss.str() << std::endl;
        
        // fill it the second time
        ss.str(string());
        ss << "attempt 2";
        std::cerr << ss.str() << std::endl;

Regards,
Angus

Reply via email to