Prev: std::vector<char> instead of std::string, where are the string searching functions?
Next: Converting new [] to vectors
From: Simon on 26 Feb 2010 05:29 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 26 Feb 2010 13:37
> 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! ] |