On 13/10/2016 13:24, Edward Diener wrote:
Are you assuming that programmers using your small library compiler with c++11 support ?
Mostly I'm writing apps, or libraries for use within my organisation,
not really for public consumption. So based on the intended target
app/environment I already know whether it supports C++11 or not and can
pick accordingly.
Perhaps I'm not the intended audience of your question in that regard. :)
Not so much with shared_ptr (since boost::shared_ptr is a reasonable
default for the dual case anyway), but in some cases where something
needs to be used in both environments I'll put in some custom
redirection eg:
#if some_detection_magic
#include <atomic>
namespace my_atomic { using std::atomic; }
#elif some_other_detection_magic
#include
Otherwise, I'll use boost::shared_ptr, except where required to use std::shared_ptr by existing interfaces.
So if existing interfaces already used std::shared_ptr you'd keep them like that, else for any new shared pointer interfaces you would use boost::shared_ptr ?
If my code depends on something that uses std::shared_ptr then of course I'll use std::shared_ptr in the downwards-facing interfaces with that. But I will prefer boost::shared_ptr for any upwards-facing interfaces unless there's some compelling reason not to use it (such as not otherwise requiring a dependency on Boost).