dimanche 24 septembre 2017

stringstream << operator doesnot work with Macro with C++11

We have some Macros like

#define LOGG(out,line,file,.....)
    std::stringstream logprocess;  \
    logprocess << std::stringstream(out) ;                \
    functiona(out,....,....);
}

So the thing to be passed to LOGG can be like:

LOGG(message<<"i would like to print"<<interger,......)

So we mainly use "<<" to constructor from whater ever type we want and then send to the MACRO LOGG. It works perfect with gnuc++ 98 but we it is compiled with -std=c++11, it gives error:

error: no match for 'operator<<' (operand types are 'std::stringstream {aka std::basic_stringstream}' and 'std::stringstream {aka std::basic_stringstream}')

Aucun commentaire:

Enregistrer un commentaire