Hi Fang,
easy, if you use the PolyPolygonCacheKey as outlined in my last mail you
can just
add the less operator there. Since stl only uses this operator for
performance
reasons it is up to you how to implement it. I would implement this to
return true
for the less operator if the reference PolyPolygonCacheKey is not equal
and if
the this pointer of the reference PolyPolygonCacheKey is bigger than my
own this.
So:
bool operator<( const PolyPolygonCacheKey & rKey ) const
{
return !((*this) == rKey) && (this < &rKey);
}
I think this maybe fails if you store the PolyPolygonCacheKey by value
as the map
key. Maybe you must use something like a shared pointer from stl or
boost to have
a consistent this pointer.
Regards,
Christian
Fang Yaqiong wrote:
> Hi Christian,
> If we want to new a map to store the PolyPolygon and if we use the method
> find() of the map, the operand < should be overloaded in the class Polygon.
> Because the method find() is using < and == to compare to find the matched
> key. But the operand < is not defined in the PolyPolygon .
>
> class PolyPolygon has one member variable it is
>
> ImplPolyPolygon * mpImplPolygon;
>
> class ImplPolyPolygon has several member variables they are
>
> SVPPOLYGON* mpPolyAry;
> ULONG mnRefCount;
> USHORT mnCount;
> USHORT mnSize;
> USHORT mnResize;
>
> The operand < is not defined in the classes.
> I find it is hard to compare which object of ImplPolyPolygon is bigger than
> another.
>
> So if there is another way to store the PolyPolygons, and change the key of
> it?
>
> I am looking forward to your reply.
>
> Sincerely,
> Fang
>
>
>
>
> Fang Yaqiong [EMAIL PROTECTED]
> 2007-05-23
> Regards&Thanks!
> Tel:010-5157-0010 Ext.6202
> Beijing Redflag CH2000 Software Co., Ltd.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]