uncallable template constructor?

Viewed 926

A templated member function, with template arguments not used in the parameter list can be called in the following form:

struct C { template <class> func (); };
C c;
C.func <int>();

But how do I call a template constructor, which does not use a template parameter in its argument list?

struct D { template <class>  D (); };

Certainly

D<int> d;

Cannot be the syntax, as this is the construction of a variable of type D <int>,, which is an instantiation of class template D<class>.

This is not just an academic question, I have use for templated constructors (not using the template in the constructor argument list), basically policybased factories and currently use a dummy parameter mpl::identity <mytype>() as a workaround.

1 Answers
Related