Re: Something wrong with ustring::const_iterator



Am Montag, den 27.04.2009, 18:23 +0100 schrieb Chris Vine:
> On Mon, 27 Apr 2009 11:38:44 -0400
> Hubert Figuiere <hub figuiere net> wrote:
> > No. The C++ lookup for the method would determine the method based on 
> > the return type first, and then check for const-ness, which is in
> > that case fine as non-const -> const is allowed.

As far as I'm aware, C++ lookup never ever considers the return type of
an expression, with only one exception:  Taking the address of an
overloaded function.

> Snip the test case below out, and compile it with and without the two
> argument templated version of operator !=().  If you comment it out it
> won't compile.  (Compare with the single templated version in ustring.h)

This is odd, because I could have sworn this used to work, and that
operator==() wasn't a template.  Apparently I'm wrong, I can't find any
changes in the history either.

I think it should just work to make the comparison operators
non-templated functions that take const_iterator arguments only, and
rely on the implicit conversion from iterator to const_iterator.

Oh well.  I guess I never noticed because I make my strings const
whenever possible.

--Daniel




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