Namespaces
Variants
Views
Actions

C++ concepts: CopyInsertable

From cppreference.com
< cpp‎ | concept
Revision as of 18:23, 20 March 2014 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 
 
 

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

[edit] Requirements

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 type T satisfies MoveInsertable, and 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.

[edit] Notes

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