[geos-devel] Issue with returning Coordinate * rather than value

Norman Vine nhv at cape.com
Fri Nov 15 12:56:26 EST 2002


David Blasby writes:

> > Coordinate *getAt(int i)  /// Safe
> > Coordinate *[int i]   /// DANGER !!!! super fast RAW access
> 
> Yes - I like that. The getAt(int) should return a non-pointer or its should allocate a new
> Cooridinate and return that.
> 
> Is the [int] method going to do range checking or are we just going to assume the caller is
> competent?

Good question :-)

I usually just have it  return the underlying vector<> [] operator
if you want SAFE access DON'T use it !!

Norman





More information about the geos-devel mailing list