From 6247021355100753756
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,a9e0bc9c2025eeb2
X-Google-Attributes: gidf78e5,public
From: David Vandevoorde <vandevod@cs.rpi.edu>
Subject: Re: Template member function
Date: 1996/08/08
Message-ID: <3208DDF1.41C67EA6@cs.rpi.edu>#1/1
X-Deja-AN: 172944594
references: <1996Aug6.061314.5177@iiasa.ac.at> <4u7253$pg4@o.online.no> <32079151.41C67EA6@cs.rpi.edu> <4u90po$2qu@news1.panix.com>
x-original-date: Wed, 07 Aug 1996 14:18:25 -0400
organization: Rensselaer Polytechnic Institute
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++
originator: austern@isolde.mti.sgi.com
x-mailer: Mozilla 2.02 (X11; I; SunOS 4.1.3_U1 sun4m)


Atman Binstock wrote:
> David Vandevoorde <vandevod@cs.rpi.edu> wrote:
[...]
> >       A a;
> >       a.template process<int>();
> 
> Do you have to use the template key word?
> I thought
>         a.process<int>();
> was the way you called it.

The template keyword is mandatory. Otherwise, the parser must
take `process' to be a non-template and the following `<' to
be a less-than operator ([temp.names] 14.2/4 in my copy of the 
DWP).

The rules here are not always very intuitive. Take the following:

	template<typename T>
	struct S {
	    ~S();
	};

	void
	f() {
	    S<int>& p = ...;
	    p.A<int>::~A();
	}

In this explicit destructor call, the template keyword is neither
required not allowed. I.e., this `template' prefix _only_ applies
to names of _member_ templates with explicit argument dependency.

	Daveed
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



