On Fri, 28 Jun 2019 at 11:38, Andrey Semashev via Boost < boost@lists.boost.org> wrote:
Most C-style APIs follow the new/delete pattern, where you have a function that allocates and initializes a structure, returning a pointer to it, and another one to free it, along with any associated resources.
Doesn't sound like overkill to me, now I have no dependency and I can add details at will [without reading any docs].
Using a smart pointer to store a pointer to that structure is perfectly valid, and the easiest and most natural thing to do.
Right, most natural since C++11 that is then.
And using a smart pointer to manage that resource is perfectly adequate.
It's the "if-I-have-a-hammer-everything-looks-like-a-nail-syndrom". degski -- @realdegski https://edition.cnn.com/interactive/2019/06/middleeast/saudi-teen-death-pena... "Anyone who believes that exponential growth can go on forever in a finite world is either a madman or an economist" - Kenneth E. Boulding