Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cdeque<T, Allocator>& operator=(cdeque<T, Allocator>&& other)
noexcept(alloc_traits::propagate_on_container_move_assignment::value) {
if (this != &other) {
if (alloc_traits::propagate_on_container_move_assignment::value) {
destruct();
impl.alloc() = std::move(other.impl.alloc());
impl.begin_storage = std::move(other.impl.begin_storage);
impl.end_storage = std::move(other.impl.end_storage);
impl.begin_cursor = std::move(other.impl.begin_cursor);
impl.end_cursor = std::move(other.impl.end_cursor);
} else {
if (impl.alloc() != other.impl.alloc()) {
destruct();
impl.clear();
}
assign(std::move_iterator<iterator>(other.begin()),
std::move_iterator<iterator>(other.end()));
other.destruct();
}
other.impl.clear();
}
return *this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment