Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

make_shared_resource

Return shared ownership of a new, dynamically allocated memory resource.

Synopsis

Defined in header <boost/json/storage_ptr.hpp>

template<
    class T,
    class... Args>
storage_ptr
make_shared_resource(
    Args&&... args);
Description

This function dynamically allocates a new memory resource as if by operator new that uses shared ownership. The lifetime of the memory resource will be extended until the last storage_ptr which points to it is destroyed.

Mandates
std::is_base_of< memory_resource, T >::value == true
Complexity

Same as new T( std::forward<Args>(args)... ).

Exception Safety

Strong guarantee.

Template Parameters

Type

Description

T

The type of memory resource to create.

Parameters

Name

Description

args

Parameters forwarded to the constructor of T.

Convenience header <boost/json.hpp>


PrevUpHomeNext