[Proj] C++ coding practices w.r.t object ownership
Mateusz Loskot
mateusz at loskot.net
Sun May 27 16:48:53 EST 2018
On Sun, 27 May 2018, 23:26 Even Rouault, <even.rouault at spatialys.com> wrote:
> > 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
std::make_shared is the canonical
and efficient way to manage shared_ptr instances.
The new should be hardly ever needed.
BTW, I've been reading the thread, nothing major to add though - I myself
agree with Kurt's points.
For minor points, little point to discuss those and generate unfocused
traffic.
Mateusz Loskot, mateusz at loskot.net
(Sent from mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20180527/fe848cdc/attachment.htm
More information about the Proj
mailing list