Problem with overload resolution.

scott snyder snyder@d0sgif.fnal.gov
Sun May 24 13:51:00 GMT 1998


> From: njs3@doc.ic.ac.uk (Niall Smart)
> I'm not familiar with the legalese used the standard, so perhaps
> I'm out of my depth here, but do the two end() members return
> "similar types"?
> 
> class it {};
> class ci {};
> 
> class list {
> public:
>   it end();
>   ci end() const;
> 
> 
> Niall


My understanding is that the overload resolution is based
on the arguments to end(), not what it returns.
Here, the argument to end() is the implicit `this' pointer,
which in the first case is a `list *' and in the second
a `list const *'.

(Note that the example here is simplified from the STL list class,
which has end() returning distinct (template) classes depending on
whether the call is const or not.)

sss



More information about the Gcc-bugs mailing list