[Kde-imaging] Re: Operator== for ImageCollection

Renchi Raju renchi at pooh.tam.uiuc.edu
Sat Jul 17 11:37:40 CEST 2004



On Sat, 17 Jul 2004, Aurelien Gateau wrote:

> Le samedi 17 Juillet 2004 11:05, Renchi Raju a écrit :
> > our implementation works the same way as jesper mentioned. so it will not
> > work for us either. i would recommend having two different functions
> > operator==() and equals(), one which does pointer comparison and the other
> > compares the urls of included items.
>
> I think having both methods is useless if the pointer comparison is not used.
> What about the following change:
>
>
> bool KIPI::ImageCollection::operator==(const KIPI::ImageCollection& ic)
> {
>   return *_data==*(ic->_data);
> }
>
> And:
>
> bool KIPI::ImageCollectionShared::operator==(
>   const KIPI::ImageCollectionShared& ics)
> {
>   return images()==ics.images();
> }
>
> This last one could be virtual so that an host app can implement its own
> comparison operator.
>
> Does it sound better?

yes, it does. it might be a trivial point, but what if a plugin wants to
compare pointers, just as some sort of sanity checks; then there would
need to be a pointer comparison function also.

renchi


More information about the Kde-imaging mailing list