member template explicit qualification in VC6

David Hanak dhanak at isis.vanderbilt.edu
Mon Dec 15 10:12:43 CST 2003


On Sat, 13 Dec 2003, Attila Vizhanyo wrote:

> Consider the following C++ class definition:
> [...]
>      typedef int T;
>      T t= a.getT();  // return types are not used in template  parameter deduction

Well, I don't know how to do it officially (or if it's possible at all),
but there's a workaround: use a dummy argument of the same type.

   class A
   {
   public:
        template <class T> T& getT(T t);
   };

And then

    A a;
    int i = a.getT(0);

should do the trick.

-- 
David



More information about the gme-users mailing list