variadic templates and explicit instantiation
Kai Henningsen
kai.extern@gmail.com
Sun Jan 29 06:31:00 GMT 2012
Maybe I'm confused, but I'm having trouble with explicit instantiation
of variadic templates.
Example:
x.hh:
template < class T, class ... P > std::shared_ptr < T > make(P
... args);
xx.cc:
template < class T, class ... P > std::shared_ptr < T > make(P ... args)
{
return std::shared_ptr < T > (new T(args ...));
};
template std::shared_ptr < File > make < File, char const
*>(char const *); // works
template std::shared_ptr < Include > make < Include, char
const *, bool > (char const *, bool); // doesn't work
That last line gets
error: template-id 'make<Include, const char*, bool>' for
'std::shared_ptr<Include> make(const char*, bool)' does not match any
template declaration
(gcc 4.6)
So ... should I write that differently (how?), or is gcc confused here?
More information about the Gcc-help
mailing list