help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: template argument required


From: Larry I Smith
Subject: Re: template argument required
Date: Mon, 16 May 2005 17:39:22 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414

Patrick Rammelt wrote:
Larry I Smith wrote:

'class' should not be required.  In fact, it may
confuse the issue (on some compilers).  Try:

  A<T> & foo (X p) {
    ...
  }


Yes, that works too. Thanks again. Now I have three working and one non-working version:

Working:
class A<T>& foo (X p) { ... } // 1)
A<T>& foo (X p) {... }        // 2)
A& foo (X p) { ... }          // 3)

Not Working:
class A& foo (X p) { ... }    // 4)

So is it a gcc-bug? In my opinion 3) and 4) should not behave differently (I do not really understand why "class" confuses my new little gcc).

Ciao,
Patrick

I'm going to go out on a limb here; I'm sure that smarter
folks will correct me if I'm wrong...

1) 'class' is redundant and un-necesary
2) declares that foo() returns a ref to an 'A<T>'
3) declares that foo() returns a ref to an 'A' whose 'T' is not
   specified (similar to a base class??).  not very useful?

You might get better (correct??) answers in the newsgroup:

 comp.lang.c++

Some smart folks hang out there.

Regards,
Larry

--
Anti-spam address, change each 'X' to '.' to reply directly.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]