samedi 25 août 2018

Difference between list and forward_list performance?

As with c++11 we have two types of list:

std::list<int> lst = { 1, 2, 3, 4, 5 };

std::forward_list<int> flst = { 5, 4, 3, 2, 1};

As we know that the list is based on the doubly linked list and forward_list is based on the singly linked list.

How should we decide which one to used? Is there any performance benefit of any of the list above other?

Aucun commentaire:

Enregistrer un commentaire