Someone has given me the following C++ code snippet to try out - and now I have lost contact with them (its a long story). Anyway, it won't compile - I get an error
error C2512: 'mstream' : no appropriate default constructor available
Can anyone explain why, and what is needed to fix it.
class mstream : private ostream
{
public:
mstream& operator << (char *value)
{
printf ("[%s]\n", value);
return *this;
}
mstream& operator << (int value)
{
printf ("[%u]\n", value);
return *this;
}
};
mstream g_mcout;
EDIT: Oops, missed this out...
ostream& mcout ()
{
return g_mcout;
}
ostream& SgDebug ()
{
return g_mcout;
}
FYI: the reason for this strange looking code is all to do with merging a C++ with a C program. The printf()'s will actually be changed to my_printf()'s which do a wide variety of custom things.
mstream
class?ostream
and then usingstdio
?