News for hackers. Stuff that matters.
Re:In C++, is empty() faster than comparing the size with zero? by brandmeyer on Thursday October 28, 2021 @02:23PM (#29029393)
Once upon a time, size() wasn't required to be constant-time. This showed up in some standard library implementations of std::list::size which actually did count all the things.

The painful ABI break at C++11 is a big part of why implementors were so opposed to allowing another ABI break in C++20.

Re:In C++, is empty() faster than comparing the size with zero? by jeffbee on Thursday October 28, 2021 @02:40PM (#29029751)
It's also why other people in the C++ community are opposed to ABIs themselves.
Re:In C++, is empty() faster than comparing the size with zero? by brandmeyer on Thursday October 28, 2021 @03:21PM (#29030427)
The live-at-head model really only works well in a cloud computing or JIT environments. It really shouldn't have been a surprise to find that this model is unpopular outside of those narrow use-cases.
Re:In C++, is empty() faster than comparing the size with zero? by jcelerier on Thursday October 28, 2021 @06:30PM (#29032862)
in my personal experience it also works great for desktop software
Re:In C++, is empty() faster than comparing the size with zero? by saagarjha on Thursday October 28, 2021 @11:00PM (#29034711)
That depends. It’s awful for the libraries that your OS provides to support your desktop app, for example.