Boost logo

Boost :

Subject: Re: [boost] Curiousity question
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-10-13 09:44:15


On 10/13/2016 5:43 AM, Andrey Semashev wrote:
> On 10/13/16 12:14, Andrey Semashev wrote:
>> On 10/13/16 01:58, Edward Diener wrote:
>>> I would like to ask a design question for any Boost developers or anyone
>>> on this mailing list who might care to answer.
>>>
>>> You are designing or working on a library, perhaps for Boost, perhaps
>>> for fun, and part of the design of the library has some public
>>> functionality taking a shared pointer as input. You:
>>>
>>> 1) Use boost::shared_ptr
>>> 2) Use std::shared_ptr
>>> 3) Use both boost::shared_ptr and std::shared_ptr with the same
>>> functionality
>>> 4) Use neither, you roll your own shared pointer-like functionality
>>> 5) You don't lke shared pointers and use raw pointers instead
>>>
>>> I really am curious about this. I haven't put any limitation on your
>>> library or made any presumption on who your library is for, on purpose.
>>> Thanks for anyone answering !
>>
>> Depends on the target. If I can rely on C++11 features being available
>> in the project then I use std::shared_ptr. Otherwise I use
>> boost::shared_ptr. Both times unconditionally, i.e. no auto-detection
>> stuff.
>
> I should also say that I find myself often using boost::intrusive_ptr
> instead of either std::shared_ptr or boost::shared_ptr but I'm not sure
> that's the answer you're looking for.

It is not the answer I am looking for, but I can easily change the
question as being between boost::tuple or std::tuple, or boost::function
or std::function etc. You get the idea I believe. I chose
boost::shared_ptr or std::shared_ptr because I assumed that using shared
pointers versus raw pointers was mainstream in the C++ programming world
by now, but your answer just above foiled me <g>.


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