I know that std::deque has the different chunks of contiguous memory and iterator is invalidated by inserting or erasing the middle of deque.
In addition to it, if I insert to the end side of element of deque, iterator is not valid but reference is valid.
There are some other unintuitive behavior of iterator of deque. Refer to the link below.
I'm very curious why does the iterator should work like that. If I know the underlying data structure of deque, I can clearly understand it. But I can't find any detailed explanation of how does std::deque works yet.
Could anyone explain the underlying data structure of std::deque and why it's iterator works like that ?