Std :: deque :: erase, T must be MoveAssignable, how to dodge?

As the next question is from here , I am wondering if there is a way around the MoveAssignable for std :: deque :: erase. In fact, I have a bunch of interconnected classes with lots of const types and references that are far from MoveAssignable. I need to contact them, but without being able to use erasure, it becomes meaningless. Any ideas?

+4
source share
1 answer

The path is std::dequedesigned to work, requiring that its contents be relocatable (otherwise it does not require a concept MoveAssignable). This means that you cannot use deque (or vector for that matter) with immovable types. But you can use a container that does not move its elements, for example, std::listor associative containers.

+4
source

Source: https://habr.com/ru/post/1617208/


All Articles