← Back to team overview

dolfin team mailing list archive

Re: RFC: remove (container.size() == 0) idiom

 

>>>> leading to completely unnecessary O(N) operations (racall that size() is
>>>> O(N) for a map or a list).
>>>>
>>> While true for a list, it is not a problem for maps or sets:
>>
>> http://gcc.gnu.org/onlinedocs/libstdc++/manual/containers.html#sequences.list.size
>
> Yet another reason I hate gcc.  Anywho the foo.empty() is better anyway as
> it does represent the idea.

Gcc's list has O(1) size() in c++11 mode (it's mandated for all
containers by the C++11 standard).

Just for information, I have no opinion on the change.

(but I do hope everybody switches to c++11 soon, just for "auto")

-j.


References