does std::string store data differently than a char* on either stack or heap or is it just derived from char* into a class?
char*
malloc
or calloc
or new
or new[]
.
free
or delete
or delete[]
when you're done.char[ N ]
(constant N) array or string literal.
char*
argument points to stack, heap, or global space.
and such.std::string
new
or delete
.
char*
.new[]
much as you would to obtain a char*
.char*
or literal.c_str()
which returns a char*
for temporary use.std::string::iterator
type with begin()
and end()
.
string::iterator
is flexible: an implementation may make it a range-checked super-safe debugging helper or simply a super-efficient char*
at the flip of a switch.