On Wed, 2013-11-20 at 15:14 -0500, Alan Conway wrote:
> r1543922 NO-JIRA: HA remove use of make_shared, not available in RHEL5 boost.
I think a much better direction to fix this would be to introduce an
indirected make_shared so that we can get the significant benefits of
make_shared on the platforms that support it, and not have to worry
about the (frankly old) platforms which don't.
The simplistic replacement code for make_shared is pretty simple after
all (although you do need multiple versions with different numbers of
arguments for C++98):
[I hope I don't screw this up completely after saying it's simple]
template<typename T>
shared_ptr<T> make_shared(){
return new T;
}
template<typename T, P1>
shared_ptr<T> make_shared(const P1& p1){
return new T(p1);
}
template<typename T, P1, P2>
shared_ptr<T> make_shared(const P1& p1, const P2& p2){
return new T(p1, p2);
}
etc. up to the number of parameters you wish to support.
Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]