[C++] Should the complexity of std::list::size() be O(n) or O(1)?
Gabriel Dos Reis
gdr@cs.tamu.edu
Thu Nov 24 19:57:00 GMT 2005
"Peter Dimov" <pdimov@mmltd.net> writes:
| Gabriel Dos Reis wrote:
| > Howard Hinnant <hhinnant@apple.com> writes:
| >
| > [...]
| >
| >> Conclusion: Yes, you can store the size externally. But you loose
| >> performance and/or functionality in the above members that will also
| >> have to be recoded.
| >
| > I think I'm still unconvinced that we have to change list::size, here.
| >
| > Since it was a mistake to put it there in the first place, why shall
| > we penalize proper list operations by trying to make an error run
| > faster?
|
| The current status quo is the worst of both worlds.
Certainly. My point was that I'm not convinced penalizing proper list
operations is the right resolution.
-- Gaby
More information about the Libstdc++
mailing list