Should std::list::size have constant complexity in C++11?

后端 未结 1 785
你的背包
你的背包 2020-12-11 15:37

I am using gcc 4.8.1 and after hours of debugging a horrible mysterious performance issue I found out that the std::list::size is actually impl

相关标签:
1条回答
  • 2020-12-11 16:13

    This is not exactly a bug and you can read about it here:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49561

    It's more of a case of compatibility with older versions of gcc. Looks like they really don't want to add an additional "data member".

    Quoting:

    This patch made c++98 and c++11 code incompatible and is causing serious problems for distros.

    Where the patch is the fix they implemented for gcc 4.7 (it was O(1) in it).

    Another quote:

    maintaining ABI compatibility has been decided to be more important for the current releases

    0 讨论(0)
提交回复
热议问题