Share via


allocator_traits::construct Method

Static method that uses a specified allocator to construct an object.

template<class Uty, class Types>
    static void construct(Alloc& al, Uty *ptr, Types&&... args);

Parameters

  • al
    An allocator object.

  • ptr
    A pointer to the location where the object is to be constructed.

  • args
    A list of arguments that is passed to the object constructor.

Remarks

The static member function calls al.construct(ptr, args...), if that expression is well formed; otherwise it evaluates ::new (static_cast<void *>(ptr)) Uty(std::forward<Types>(args)...).

Requirements

Header: <memory>

Namespace: std

See Also

Reference

allocator::construct

allocator_traits Class