Quote:
In case anyone cares about the longer explanation, the empty() function is guaranteed to be constant time where the size() function is not. In practice, for most containers including deque they are both constant time and empty() just returns size() == 0, but there are some implementations where that isn't true. It's talked about in Effective STL #4.
|
That's awesome actually, thanks.
http://www.uml.org.cn/c++/pdf/EffectiveSTL.pdf