construct


construct construct Category: allocators Component type: function Prototype template <class T1, class T2> void construct(T1* p, const T2& value); Description In C++, the operator new allocates memory for an object and then creates an object at that location by calling a constructor. Occasionally, however, it is useful to separate those two operations. [1] If p is a pointer to memory that has been allocated but not initialized, then construct(p, value) creates an object of type T1 at the location pointed to by p. The argument value is passed as an argument to T1's constructor. Definition Defined in the standard header memory, and in the nonstandard backward-compatibility header algo.h. The construct algorithm is no longer part of the C++ standard; it was present in early drafts, and it is retained in this implementation for backward compatibility. Requirements on types T1 must have a constructor that takes a single argument of type T2. Preconditions p is a valid pointer that points to a region of memory whose size is at least sizeof(T1). The memory pointed to by p is uninitialized. That is, no object has been constructed at the location p. Complexity Example double* dp = (double*) malloc(sizeof(double)); construct(dp, 3); assert(*dp == 3); Notes [1] In particular, construct, along with other low-level memory allocation primitives, is used to implement container classes. See also Allocators, destroy, uninitialized_copy, uninitialized_fill, uninitialized_fill_n, raw_storage_iterator Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation

Wyszukiwarka

Podobne podstrony:
Furniture Construction Hints
Constructing genograms Freud and Fonda
construction*A70F9
Composite Construction Wooden Comb
Laminar Flow Hood Construction 1
No Man s land Gender bias and social constructivism in the diagnosis of borderline personality disor
Introducing the ICCNSSA Standard for Design and Construction of Storm Shelters
ConstructorS
dm construction
KIMO Constructeur http www kimo fr
ConstructorO
[architecture ebook] Design And Construction Of Japanese Gardens
Constrain
How to construct a suimple garden pond
Star Wars D20 Construcción De Sables Laser
construction iteration?567993
construction iterationw0E29E0
Modelismo Trenmania Construcción de un tractor CP 1100 Escala H0 por Vicente Uceda

więcej podobnych podstron