Boost logo

Boost :

Subject: Re: [boost] [modularization] Modularizing Boost (modularization)
From: Peter Dimov (lists_at_[hidden])
Date: 2013-11-05 07:40:11


Gavin Lambert wrote:
> A while back there was a discussion in my team whether (now that the
> current release of applications are being built in a C++11 compiler) the
> code should continue to use boost::shared_ptr as before, or mix in
> std::shared_ptr in newer code, or do a global search-n-replace. (And
> similarly for some of the threading stuff.)
>
> Mixing was quickly ruled out as too confusing and painful (due to
> incompatibilities). And we eventually decided not to search-n-replace
> because (a) the two implementations are not entirely identical, so this
> might introduce bugs; (b) continuing to use the Boost version makes it
> easier to backport changes to older releases that still use C++98
compilers; (c) presumably the Boost version would be bugfixed or
feature-enhanced in advance of the std version, or internally fall back to
the std version where compatible.
>
> Do you think that some of those assumptions are flawed?

Not flawed, but they may not be entirely correct either. (b) isn't much of
an argument since you can always do namespace std { using
boost::shared_ptr; }. In shared_ptr's case, (c) is true in that
boost::shared_ptr<T[]> is not (yet) in std, but that's probably an exception
as many (most?) such libraries are in maintenance-only mode and may even
fall behind the std versions.

If you can eliminate the dependency to Boost completely by using the
standard library, it probably would make sense to do so; otherwise, whether
to use boost::shared_ptr or std::shared_ptr is a coin toss. Both (ought to)
work.


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