Friday, November 12, 2010

Templated Copy Constructors are Not Allowed

You cannot declare a templated copy constructor, i.e.,

   template <typename T> MyClass(const T&);

The template parameter T is not necessarily MyClass, and so this is not a copy constructor.

Reference: Exceptional C++ by Herb Sutter. Addison-Wesley, 1999, p.12.

No comments:

Post a Comment