This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should the complexity of std::list::size() be O(n) or O(1)?


Gabriel Dos Reis wrote:
Jonathan Wakely <jwakely.gcc@gmail.com> writes:

On 11/29/05, Peter Dimov <pdimov@mmltd.net> wrote:

If all containers that keep their elements in a contiguous block of
memory (std::vector, std::string, std::valarray, user-defined
array, string, matrix

Sorry for going off on a tangent, but does the standard actually require contiguous storage for std::string?

It does not. But, that does not matter. Just pretend it does and if implementations don't agree you, decree they are not portable <g>.

I think that the general consensus is that while it is theoretically possible to implement a non-contiguous conforming string as an academic exercise, no implementation does that today, or will in the future, because there is simply no point in doing so.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]