A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/allocator_traits::construct below:

public static member function

<memory>

std::allocator_traits::construct
template <class T, class... Args>  static void construct (allocator_type alloc, T* p, Args&&... args );

Construct an element

Constructs an element object in place on the location pointed by p forwarding Args to its constructor.

Notice that the object is constructed in-place without allocating storage for the element.

In the non-specialized definition of allocator_traits, this member function effectively calls:


alloc.construct(p,forward<Args>(args)...)

if such a call is well formed. Otherwise, it invokes:


::new (static_cast<void*>(p)) T (forward<Args>(args)...)

A specialization for a specific allocator type may provide a different definition.



Parameters
alloc
Allocator object
allocator_type is an alias of allocator_traits's template parameter.
p
Pointer to a block of storage.
args
Arguments forwarded to the constructor.
Args is a list of zero or more types.

Return value none

See also
allocator_traits::allocate
Allocate block of storage (public static member function)
allocator_traits::destroy
Destroy object (public static member function)
allocator::construct
Construct an object (public member function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4