When is it preferable to use std::list over std::vector while working with fairly small objects (no more than 32 bits)?
The correct answer is: when inserting to the beginning. The vector performs other operations faster due to the fact that std::list more often allocates memory; iterating through std::list takes much longer than the vector.
Read more: C++ benchmark – std::vector VS std::list VS std::deque

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Зареєструйся Зараз
або Підпишись на майбутні тести