Four options compatible with C++98,
1) use impl::shared_pointer<T>
. And switch from:
namespace impl = boost;
to namespace impl = std;
2) (more elegant but more risky) is to use shared_ptr
without namespace qualification and later switch from
using boost::shared_ptr
to using std::shared_ptr
.
3) (ugly but I guess is the preferred industrial solution) Use macros all the way.
#if DETECTC++11
#define SHARED_PTR std::shared_ptr
#else
#define SHARED_PTR boost::shared_ptr
#endif
4) Combine the 3 above.
Anonymous namespaces can help to keep the using
statements local to a file, so you have per-source-file control, e.g.:
namespace{
using std::shared_ptr;
}
(I personally use 2. all the time).