[smart_ptr] make_shared imposes const ref.

Why is make_shared declared as
template

Why is make_shared declared as
template
shared_ptr<T> make_shared( Arg1 const & arg1 ); rather than
template
shared_ptr<T> make_shared( Arg1 arg1 ); since the effect is that if you have a constructor that takes non-const references you cannot use make_shared( ) on it.
I guess it's because your compiler doesn't support && (i.e. perfect
forwarding is impossible).
http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/make_shared.html#functio...
<

On Tue, Nov 29, 2011 at 11:46 AM, Igor R
Why is make_shared declared as
template
shared_ptr<T> make_shared( Arg1 const & arg1 ); rather than
template
shared_ptr<T> make_shared( Arg1 arg1 ); since the effect is that if you have a constructor that takes non-const references you cannot use make_shared( ) on it.
I guess it's because your compiler doesn't support && (i.e. perfect forwarding is impossible). http://www.boost.org/doc/libs/1_48_0/libs/smart_ptr/make_shared.html#functio... <
> _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Ah yes, thanks, I'd failed to notice the informative comment answering my exact question! - Rob.
participants (2)
-
Igor R
-
Robert Jones