Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top