|
From: Edward d'A. <tru...@gm...> - 2017-05-29 12:43:22
|
On 29 May 2017 at 14:06, James Turner <jam...@kd...> wrote:
>
> On 29 May 2017, at 13:01, Edward d'Auvergne <tru...@gm...> wrote:
>
> Just a simple question, but should SGPropertyNode_ptr class members be
> initialised to null:
>
> Ephemeris::Ephemeris() : _impl(NULL), _latProp(NULL) {}
>
> I guess this protects the subsystem if the Ephemeris::init() function
> is not called.
>
>
> No that’s automatic, that’s why smart pointers are better than dumb ones :)
>
> (And they copy correctly, and clean themselves up correctly, and…)
>
> And probably _impl should be a std::unique_ptr<SGEphemeris> and you won’t
> need the initialiser for that, or the delete / = NULL either.
Is this worth it for _impl if Ephemeris::data() is returning the raw
pointer anyway (for example if modified to return _impl.get()?
Cheers,
Edward
|