Question on STL string

  • Thread starter Thread starter Bonj
  • Start date Start date
B

Bonj

A basic string, declared using my own custom-defined typedef:
typedef TSTRING std::basic_string<_TCHAR>;
would TSTRING::data() have O(x) exeuction time proportionality to the size
of the string, or static?
 
Bonj said:
A basic string, declared using my own custom-defined typedef:
typedef TSTRING std::basic_string<_TCHAR>;
would TSTRING::data() have O(x) exeuction time proportionality to the
size of the string, or static?

It's not specified in the standard whether data() has O(n) or O(1)
complexity, but AFIAK all known implementations have O(1) complexity.

-cd
 
that's good

Carl Daniel said:
It's not specified in the standard whether data() has O(n) or O(1)
complexity, but AFIAK all known implementations have O(1) complexity.

-cd
 
A basic string, declared using my own custom-defined typedef:
typedef TSTRING std::basic_string<_TCHAR>;
would TSTRING::data() have O(x) exeuction time proportionality to the size
of the string, or static?

Static.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top