[geos-devel] GeometryCollection constructor

strk strk at keybit.net
Wed Oct 8 08:40:39 EDT 2003


nhv wrote:
> strk writes:
> > 
> > but my question is: should memory copy go further copying each
> > object in the vector instead of just the vector itself ?
> 
> Ack...
> 
> I thought we were going to use reference counted pointers
> just so we could *safely* pass pointers instead of objects around
> and not have to worry about objects being prematurely deleted
> or conversely needlessly left on the heap !!

Sometimes you really want a copy, because you are going to modify it,
while sometimes a pointer would be just fine ... 
You might make a copy when needed, but it would be better to make
it *MANDATORY* for developers willing to modify returned objects
(would a 'const'  work for that?). Alternatively every change to an object
should be done using public methods that in turn should check ownership
of the object (caller object address? is that available?) and transparently
make a copy of it when needed ... wouldn't be easier to use directly
Java for it ? ;)

--strk;



More information about the geos-devel mailing list