Dynamically allocate a new object of type T
and return a std::experimental::shared_ptr
instance that owns
the new object.
template<typename T,typename ... Args> shared_ptr<T> make_shared(Args&& ... args);
Dynamically allocate memory for a T
object and the internal data structure required for a std::experimental::shared_ptr
. Construct
a T
object in the
allocated memory using T(std::forward<Args>(args...))
.
A std::experimental::shared_ptr
instance that
owns the newly allocated object.
For the returned std::experimental::shared_ptr
p
, p.unique()
is true and p.get()
returns a pointer to the newly
constructed T
object.
std::bad_alloc
if memory could not
be allocated. Any exception thrown by T(std::forward<Args>(args...))
.
#include <experimental/atomic>