Choosing a STL container with uniqueness and which keeps insertion ordering

后端 未结 8 2042

I am unable to decide which STL container to use in the following case:

  1. I want to preserve the order of insertion of the elements
  2. The elements in the
8条回答
  •  温柔的废话
    2021-01-18 01:05

    No standard library container gives you what you want directly. I would start with a std::vector and write a free function to do the insert which does the find and the push_back for you. If this suffices, go no further. If you have performance problems, think about a more complicated solution.

提交回复
热议问题