Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2019-06-28 11:45:37


On Fri, Jun 28, 2019 at 1:08 PM degski <degski_at_[hidden]> wrote:
>
> On Fri, 28 Jun 2019 at 11:38, Andrey Semashev via Boost <boost_at_[hidden]> 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".

Maybe, but I'm definitely not looking forward wrapping something like
AVCodecContext in a custom RAII wrapper, when I can just use
unique_ptr with a deleter.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk