##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# C++ concepts: MoveInsertable (since C++11)

From cppreference.com
< cpp‎ | concept

Specifies that a rvalue of the type can be copied in uninitialized storage.

### [edit] Requirements

The type `T` is `MoveInsertable` 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
`rv` | rvalue 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, rv);

And after evaluation, the value of `*p` is equivalent to the value formerly held by `rv` (`rv` remains valid, but unspecified)

### [edit] Notes

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

If std::allocator<T> or a similar allocator is used, a class does not have to implement a move constructor to satisfy this type requirement: a copy constructor that takes a `const T&` argument can bind rvalue expressions. If a MoveInsertable class implements a move constructor, it may also implement move semantics to take advantage of the fact that the value of `rv` after construction is unspecified.

### [edit] See Also

`CopyInsertable`

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/concept/MoveInsertable&oldid=68775"