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

Kurt Schwehr schwehr at gmail.com
Sun May 27 15:26:00 PDT 2018


Agreed... Anytime you write "new" you probably shouldn't unless you are
working with a legacy API.

Trying to write c++ with a phone sucks...

On Sun, May 27, 2018, 2:51 PM Mateusz Loskot <mateusz at loskot.net> wrote:

> 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)
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20180527/bc5733a0/attachment.html>


More information about the Proj mailing list