Does the C++ standard allow a template constructor for a non-template class?

c++, constructor, templates

Solution

In [temp.mem]:

A template can be declared within a class or class template; such a template is called a member template.

Constructors are members and it isn't explicitly disallowed to make them templates.

For example, `std::shared_ptr` has many template constructors.

Problem

I want to create a class with a template constructor: ``` class foo { template <class T> foo(T var) {} }; ``` This compiles in VS2008, but I have no idea if it is a non-standard extension, or if the C++ standard allows it.

Original source