DList and SList missing length property?
Jonathan M Davis
jmdavisProg at gmx.com
Tue May 28 12:06:53 PDT 2013
On Tuesday, May 28, 2013 20:51:55 monarch_dodra wrote:
> That was in C++03. In C++11, length was reduced to 0(1). And
> splice was increased to 0(N) (I think, I don't remember the exact
> details, but it was definitely changed).
I do remember hearing something about that, though that will actually result
in some nasty performance changes to some of the code out there (including
code that I've written).
Regardless, you have the choice of making length O(1) or splicing O(1) and not
both, and C++98/03 made splicing O(1), which I'm inclined to believe is the
better choice, though having size when it's O(n) was a definite mistake on
C++'s part IMHO. I hate to think of how many times I've seen programmer's
write container.size() == 0 instead of empty(), particularly when size() was
O(n)...
- Jonathan M Davis
More information about the Digitalmars-d
mailing list