C++0x forward_list在不同场景下的性能如何

What is the performance of C++0x forward_list under different scenarios?

本文关键字:性能 forward list C++0x      更新时间:2023-10-16

我一直在使用std::forward_list,其中我需要一个列表,但不需要双向迭代器,但如果能看到forward_li斯特在一系列配置的一系列场景下的性能分析,那就太好了,例如;

  • forward_list::erase_after()与list::erase()
  • forward_list::push_front()与list::push_filnt()
  • std::next(forward_list::iterator,n)与std::next(list::iterate,n)
  • forward_list::迭代器++与list::迭代器++

我已经在向量和数组中看到了很多这样的内容,在更新的forward_list中也可以看到它。

请只回答富有成效的问题。

forward_list没有erase()方法;我想你是指erase_after()

问题中的所有方法对都具有完全相同的渐近复杂度(std::next(it, n)n中是线性的,其余的是恒定时间)。