monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] using empty() instead of size()


From: Jens Finkhäuser
Subject: Re: [Monotone-devel] using empty() instead of size()
Date: Mon, 22 Sep 2008 22:23:06 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Spooky.

On Mon, Sep 22, 2008 at 11:18:14PM +0200, Markus Wanner wrote:
> Hi,
>
> Zack Weinberg wrote:
>> I'm honestly surprised .empty() and .size() == 0 don't generate
>> identical code, but hey.  Thanks!
>
> For example for doubly linked lists, it's pretty simple to tell whether  
> they are empty or not, but counting the number of elements in the list  
> requires traversing the list.
>
> I'm not sure how other containers are affected. Plus some STL  
> implementations might have optimizations for .size() to not require it to 
> traverse the elements. However, its an optimization not required by the 
> standard, AFAIK.
>
> Regards
>
> Markus
>
>
>
> _______________________________________________
> Monotone-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/monotone-devel

-- 
I'm Mr. T and this is my Nightelf Mohawk.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]