On 10/13/2016 4:21 AM, Oswin Krause wrote:
Hi,
On 2016-10-13 00: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: [...] 2) Use std::shared_ptr
From my point of view, this is the best option and I would go so far as to say that this holds for almost all boost libraries that were included in c++11. My main argument is that it makes it easier for new projects to introduce boost, as it fits better into the c++11 environment. I agree that for most libraries, the boost version are a bit better or have a few more features, but for me this does not outweigh the cost of incompatbility with standard c++11 coding habits. I can not force a project to adopt all of boost even if they are only interested in a tiny fragment of it.
I gather then that your library is for programmers using C+11 on up.
Otherwise, if there are deep concerns about compatibility with boost, i would try to introduce a policy or simply use template arguments which just assume it is a shared_ptr of some kind.
In other words you would roll your own class template ?
Best, Oswin