KDE/kdelibs/kdecore

Andreas Pakulat apaku at gmx.de
Tue Jul 8 08:30:14 BST 2008


On 07.07.08 23:19:59, Thiago Macieira wrote:
> Andreas Pakulat wrote:
> >I'm not sure why the const_this is needed here anyway, shouldn't a
> > simple const_iterator and ::constEnd() be sufficient too?
> 
> It's needed because of the missing constFind() function. There are two 
> overloads to find(): one non-const returning an iterator and a const 
> returning a const_iterator. The only way to select the const version (and 
> hence avoid detaching) is to have a const container.

aah, I thought the compiler was clever enough to use the const-version
when I'm doing

QHash<Foo,Bar>::const_iterator it = somemap.find();

Due to the needed const-type on the left hand side.

Andreas

-- 
Chicken Little was right.




More information about the kde-core-devel mailing list