modernize std::deque

Closes #3748 and #2343.