mercredi 1 juillet 2015

cannot use operator= with std::stringstream

I am trying to make a struct, in which one of the members are std::stringstream type. I am using c++11, accrdong to this I could do it: http://ift.tt/1dwDKbo Here is my code:

struct logline_t
    {
        stringstream logString; /*!< String line to be saved to a file (and printed to cout). */
        ElogLevel logLevel; /*!< The \ref ElogLevel of this line. */
        timeval currentTime; /*!< time stamp of current log line */

        logline_t& operator =(const logline_t& a)
        {
            logString = a.logString;
            logLevel = a.logLevel;
            currentTime = a.currentTime;

            return *this;
        }
    };

It doesnt compile, as I am getting this error:

error: use of deleted function ‘std::basic_stringstream<char>& std::basic_stringstream<char>::operator=(const std::basic_stringstream<char>&)’

I dont understand why doesnt it work, I have tried logString = move(a.logString); as well. same result. I would apreciate all help.

Aucun commentaire:

Enregistrer un commentaire