Does the C++ standard library have a set ordered by insertion order?

前端 未结 6 353
春和景丽
春和景丽 2021-01-11 09:30

Does the C++ standard library have an \"ordered set\" datastructure? By ordered set, I mean something that is exactly the same as the ordinary std::set but that

6条回答
  •  囚心锁ツ
    2021-01-11 10:11

    I thought the answer is fairly simple, combine set with another iteratable structure (say, queue). If you like to iterate the set in the order that the element been inserted, push the elements in queue first, do your work on the front element, then pop out, put into set.

提交回复
热议问题