http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49561 Коротко:
2011-06-28 08:17:46 UTC
„I realized that the complexity of std::list::size() is O(n), not O(1).
This does not conform to standard. The standard states that size() function is in constant time for alls containers. So, the behavior of gcc is not as expected.“
2011-10-04 22:22:39 UTC
„Done. If you can, please stress std::list in C++0x mode in order to shake possible bugs related to the O(1) size in time for the 4.7.0 release.“
2012-07-03 01:40:12 UTC
„Patch reverted, thus in C++11 mode size() is back to O(n) but std::list can interoperate with the C++98 version of it.“
2012-07-03 03:35:31 UTC
„Why has this been reverted? If std::list<>::size() is not O(1), then GCC's C++11 standard library is not compliant with the C++11 international standard. I have personally spoken with multiple members of the standard body and confirmed that this behavior is REQUIRED by the C++11 standard.
Please re-apply this patch for C++11 mode, or state somewhere in the GCC docs that GCC is not compliant with the C++11 standard. In the C++03 and C++98 standards, it was highly suggested that compiler vendors implement std::list<>::size() as O(1).“
2012-07-03 08:31:18 UTC
„Yes, we're well aware of that, thanks.
This patch made c++98 and c++11 code incompatible and is causing serious problems for distros.
You've lived with O(n) size for 15 years, you can live with it for a while longer until libstdc++'s ABI changes.“
„15 років жрали лайно - жріть і надалі“.
Завтра буду лякати співробітників. Особливо одного який кричав і бризкав слиною шо if (cont.size() == 0) це нормально і не треба писати if (cont.empty()).