C++ named requirements: DefaultInsertable
Specifica che un'istanza del tipo può essere default-costruita sul momento da un certo allocator.
Requisiti
Il tipo T è DefaultInsertable nel Container X il cui value_type è identico a T se, dato
A
|
un allocator type |
m
|
un lvalue di tipo A
|
p
|
il puntatore T* generato dal container
|
dove X::allocator_type è identico a std::allocator_traits<A>::rebind_alloc<T>,
la seguente espressione è ben formata:
std::allocator_traits<A>::construct(m, p);
Se X non è allocator-aware, il termine è definito come se A fosse std::allocator<T>, con l'eccezione che nessun allocator deve effettivamente essere creato, e specializzazioni definite dall'utente di std::allocator non vengono istanziate.
Note
Di default, questo chiamerà un placement-new, come in ::new((void*)p) T() (ovvero, value-initialize l'oggetto puntato da p). Se l'inizializzazione per valore è sconveniente, per esempio se l'oggetto è di un tipo che non è una classe e non è necessario azzerarlo, questo può essere evitato fornendo una custom Allocator::construct.
By default, this will call placement-new, as by ::new((void*)p) T() (that is, value-initialize the object pointed to by p). If value-initialization is undesirable, for example, if the object is of non-class type and zeroing out is not needed, it can be avoided by providing a custom Allocator::construct.
Vedi anche
| DefaultConstructible | |
| CopyInsertable | |
| MoveInsertable | |
| EmplaceConstructible | |
| Erasable |