Namespaces
Variants
Views
Actions

C++ concepts: CopyInsertable

From cppreference.com
< cpp‎ | concept
 
 
 

Specifies that an instance of the type can be copy-constructed in-place by a given allocator.

[edit] Requirements

The type T is CopyInsertable into the container X whose value_type is identical to T if T is MoveInsertable into X, and, given

A an allocator type
m an lvalue of type A
p the pointer of type T* prepared by the container
v expression of type (possibly const) T

where X::allocator_type is identical to std::allocator_traits<A>::rebind_alloc<T>,

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 unchanged.

If X is not allocator-aware, the term is defined as if A were std::allocator<T>, except that no allocator object needs to be created, and user-defined specializations of std::allocator are not instantiated.

[edit] Notes

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