[geos-devel] RE: TaggedLineSegment

Mateusz Łoskot mateusz at loskot.net
Sun Apr 30 18:25:22 EDT 2006


strk at refractions.net wrote:
> On Wed, Apr 19, 2006 at 10:53:53AM -0700, Martin Davis wrote:
> 
>> I probably did this for simplicity of programming.  I would think
>> you can replace the subclass relationship with a uses relationship.
>> 
> 
> 
> This won't remove the overhead associated with copying coordinates.

Hmm, TaggedLineSegment seems to be non-copyable type, so the only
overhead I can see during construction.

> I'll leave it as it is for now, but this is a place that really calls
> for shared_ptr<> usage... 

Yup, that's the solution.

> Using pointers would be ok too, but I'm
> kind of scared of keeping pointers to Coordinates returned from
> CoordinateSequence as references, it's hard to ensure memory
> integrity that way (adding a point to the source CoordinateSequence
> could trigger a complete reallocation of the underlying vector)

You're 100% right, returning such object by-ref can cause real troubles.

Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net



More information about the geos-devel mailing list