Search code examples
c++listunordered

c++ Unordered List Example


I realized that c++ list is ordering the entries. Do you know whether there is an unordered list defined in C++? Is there any example?

Thanks


Solution

  • I realized that c++ list is ordering the entries.

    This is actually not true.

    std::list does not perform any type of ordering, other than preserving the order you specify as you add items.

    Note that std::vector also does not reorder, and is more appropriate in many cases if you just need a collection of values which can be stored and retrieved as necessary.