M
martyn_dobson
this has probably been asked/suggested many timtes before, but i just
thought of it.
why is there no such thing as something like operator...()
imho it would allow us to smooth off one of the sharper corners of c+
+.
you could maybe do something like this:
class string
{
public:
const char *operator...() const
{
return c_str();
}
};
void foo(const char *format, ...)
{
//the usual vaarg stuff
}
void bar()
{
string s = "test";
foo("this is a test %s", s);
}
just a quick thought,
M.
thought of it.
why is there no such thing as something like operator...()
imho it would allow us to smooth off one of the sharper corners of c+
+.
you could maybe do something like this:
class string
{
public:
const char *operator...() const
{
return c_str();
}
};
void foo(const char *format, ...)
{
//the usual vaarg stuff
}
void bar()
{
string s = "test";
foo("this is a test %s", s);
}
just a quick thought,
M.