allocate_shared

Creates a shared_ptr to objects that are allocated and constructed for a given type by using a specified allocator. Returns the shared_ptr.

template<class Type, class Allocator, class... Types>
    shared_ptr<Type> allocate_shared(
        Allocator _Alloc, 
        Types&&... _Args
    );

Parameters

  • _Alloc
    The allocator used to create objects.

  • _Args
    The zero or more arguments that become the objects.

Property Value/Return Value

Returns a shared_ptr that points to the allocated object.

Remarks

The function creates the object shared_ptr<Type>, a pointer to Type(_Args...) as allocated and constructed by _Alloc.

Requirements

Header: <memory>

Namespace: std

See Also

Reference

<memory>

Other Resources

auto_ptr Members