[Proj] C++ coding practices w.r.t object ownership

Even Rouault even.rouault at spatialys.com
Sun May 27 16:23:45 EST 2018


> I'm a bit concerned by all the hidden cost of object duplication with the
> approach I tried. And if you instanciate various projected coordinate
> systems based on the same datum, currently all the datum information would
> be duplicated in each PCS object, whereas with a pointer based approach you
> would have just one instance of it.
> 

I've experienced with the shared_ptr approach in
https://github.com/rouault/proj.4/commit/85f619cbae7a0b2071681e150f93a5301fa32098

The most satisfactory result is the removal of the clone() hacks. Side effect is that the creation of
the GeographicCRS is 30% faster than the previous approach (measured on a 1 million iterations loop)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Proj mailing list