Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
memory
classes:
allocator
auto_ptr
auto_ptr_ref
raw_storage_iterator
functions:
get_temporary_buffer
return_temporary_buffer
uninitialized_copy
uninitialized_fill
uninitialized_fill_n
allocator
allocator::allocator
allocator::~allocator
member functions:
allocator::address
allocator::allocate
allocator::construct
allocator::deallocate
allocator::destroy
allocator::max_size


allocator::construct

public member function
void construct ( pointer p, const_reference val );

Construct an object

Constructs an object of type T (the template parameter) on the location pointed by p using its copy constructor to initialize its value to val.

Notice that this does not allocate space for the element, it should already be available at p (see member allocate to allocate space).

It is equivalent to:
 
new ((void*)p) T (val);


Parameters

p
Pointer to location with enough storage space to contain an element of type T.
In allocator, member type pointer is an alias of T*.
val
Value to initialize the construced element to.
In allocator, member type const_reference is an alias of const T&.

Return value

none

See also