Re: encryption problem
On Jul 30, 12:03 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
Michael DOUBEZ wrote:
Does the C++ standard state any speed requirements for the at()
method?
23.1.1/12 specifies sequence container should implement it when it runs
in constant time. IMO is applies to basic_string.
I'm not sure. I'm not sure that basic_string really is a
sequence; it just sort of looks like one. As late as CD2, for
example, it didn't support push_back. It's hard even to talk
about the intent of basic_string; so many people had their
fingers in it, and they all had different intents.
There is an explicit statement to the effect that the intent is
to allow (but not require) reference counted implementations.
In a reference counted implementation (like g++), neither
operator[] nor at() are constant time, since they may trigger a
complete copy.
Is that the reason some very old versions of g++ didn't support
at() for basic_strings?
I doubt it. If that were the case, they wouldn't support
operator[] either. A more likely reason is that they
implemented it before at() got added to the standard.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34