C++ concepts: DefaultInsertable

From cppreference.com
< cpp‎ | concept

Specifies that an instance of the type can be default-constructed in-place, in uninitialized storage.

[edit] Requirements

The type T is DefaultInsertable into the Container X if, given

A the allocator type defined as X::allocator_type
m the lvalue of type A obtained from X::get_allocator()
p the pointer of type T* prepared by the container

the following expression is well-formed:

std::allocator_traits<A>::construct(m, p);

[edit] Notes

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.

[edit] See Also