Subject: Re: [boost] Curiousity question
From: Daniela Engert (dani_at_[hidden])
Date: 2016-10-13 13:36:14


Am 13.10.2016 um 00:58 schrieb Edward Diener:

> 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:
>

> 2) Use std::shared_ptr

For libraries that are consumed only within our company,
std::shared_pointer ist the most convenient option. Our baseline
compiler is vc12 with some older stuff in maintenance mode still on
vc10, so std::shared_ptr is viable. Typically the pointer type is
typedef'd in some way for user convenience.

> 4) Use neither, you roll your own shared pointer-like functionality

The last library that I designed also for use by external customers, I
rolled my own 'handle' type which is completely opaque to users which
see just a struct with no more than one single uintptr_t member. Under
the covers it is a boost::intrusive_ptr. The idea is to prevent
accidental misuse and not to force users taking a dependency on boost.
The library itself is taking advantage of any boost functionality it
sees fit.

Hope this helps
  Dani