Why there is no pop_front method in C++ std::vector?

前端 未结 6 1838
醉话见心
醉话见心 2020-12-15 02:27

Why there is no pop_front method in C++ std::vector?

6条回答
  •  渐次进展
    2020-12-15 03:17

    Probably because it would be monumentally slow for large vectors.

    pop_front() on a vector containing 1000 objects would require 999 operator=() calls.

提交回复
热议问题