I'm trying to understand why std::make_shared is declared/implemented the way it is:
template<class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_array<_Tp>::value,
shared_ptr<_Tp>
>::type
make_shared(_Args&& ...__args)
{
return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
}
What I'm curious about is:
- Why does
make_shared
accept only rvalue-references? Why there's no overload for reference-to-constant (i.e.,const _Args &
)? - What's the point of
_VSTD::forward
call?
Good explanation or good hyperlink will both be highly appreciated.