From: Simon on
Hi everyone,

I came across a syntax that I haven't seen before, and I can't work
out what it means. Hoping someone can help me because I just have to
know.

template <typename T = void(void)>
class Foo
{
};

I've compiled it now under Microsoft Visual C++ and GNU C++ (under
MingW).

Unfortunately, I don't have the full class to see where the template
parameter is used.

What is that "void(void)"?

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Jonathan Mcdougall on
> I came across a syntax that I haven't seen before, and I can't work
> out what it means. Hoping someone can help me because I just have to
> know.

template <typename T = void(void)>
class Foo
{
public:
Foo(T f)
{
f();
}
};

void f()
{
}

void g()
{
Foo<> foo(f);
}

Remember that

void f(void);

and

void f();

are the same.

--
Jonathan Mcdougall

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]