News for hackers. Stuff that matters.
Re:In C++, is empty() faster than comparing the size with zero? by loup-vaillant on Thursday October 28, 2021 @08:05PM (#29033668)
Hmm, I’m not sure I agree there. There’s a difference between using C++ because I just want to avoid obvious waste (interpreter, GC pauses…), and actually optimizing my code.

I would put v.empty() vs v.size()==0 in the latter category. Day to day, I mostly trust that std::vector is not wasting cycles except on resizes.

There are no comments on this comment yet.