Hello,
In my application I use std::shared_ptr in the public API for loading
plugins. I wanted to use boost::dll to import dynamically plugins as
well.
It looks like for some reasons that it still use boost::shared_ptr
instead of std::shared_ptr even though C++11 is 7 years old.
I wanted to convert the boost shared_ptr to std with the following
function:
std::shared_ptr<plugin> load(boost::shared_ptr<plugin> ptr)
{
return std::shared_ptr<plugin>(ptr.get(), [ptr] (auto) {});
}
It looks like for some reasons that it still use boost::shared_ptr
instead of std::shared_ptr even though C++11 is 7 years old.
What?! Good to know because it seems the friction between boost and its std counterparts (also with error_code, etc.) is steadily growing.
Knowing that, I'll have a much lower threshold for _not_ choosing boost when evaluating libraries.
-- Stian
Wouldn't it be an option to test for the existence of std::make_shared.
This could be done using SFINAE. If it exists we can alias the
functionality from std:: into boost:: and if not we use the boost
implementation.
To make it less hairy the header could also be generated b2 before
building.
This way we maintain compatibility with older and competely unsupported
compilers running on unsupported operating systems (why are we doing
that again?) without causing interoperability trouble for others.
The reason some libraries use boost::shared_ptr rather than
std::shared_ptr has nothing to do with supporting VC7.1 at all. The most
obvious reason is that a given library works with code at the c++03
level and does not require c++11 on up. You may feel that this is wrong,
but this is another issue entirely than still having to support VC7.1.
There are of course other reasons for choosing the boost variant over the std variant, even outside of boost. Four that often influence me are:
- Boost often offers an extended API
- Boost components can be forward declared
- Boost offers the same implementation across platforms
- I can fix a boost version should I need to
There are of course other reasons for choosing the boost variant over the std variant, even outside of boost. Four that often influence me are:- Boost often offers an extended API- Boost components can be forward declared- Boost offers the same implementation across platforms- I can fix a boost version should I need toMy projects tend to reach for boost over std for most components as a result of this.-- chris