C++ concepts: CopyInsertable

< cpp‎ | concept
Revision as of 17:15, 17 August 2013 by Cubbi (Talk | contribs)


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


The type T is CopyInsertable 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
v expression of type T, provided as the argument to push_back(), etc

the following expression is well-formed:

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

And after evaluation, the value of *p is equivalent to the value of v. The value of v is not changed.

Note that if A is std::allocator<T>, then this will call placement-new, as by ::new((void*)p) T(v)