* STL string::reserve(size_t)
@ 1999-05-11 11:18 ecmorgan
1999-05-17 1:14 ` Alexandre Oliva
1999-05-31 21:36 ` ecmorgan
0 siblings, 2 replies; 4+ messages in thread
From: ecmorgan @ 1999-05-11 11:18 UTC (permalink / raw)
To: egcs
I'm currently using egcs 1.1.2 on sparc-sun-solaris2.5.1
I noticed that for the egcs STL library for basic_string, the function
basic_string::reserve is empty.
void reserve (size_type) { }
When I tried to use resize(size_type), both the reserve and the length changes.
In other words, if I have the
following lines:
string rtn;
rtn.resize(124);
rtn+="abc";
When I call resize(124), my reserve size is 128 and the length is 124. When I
append "abc" to rtn,
the length is 127 and the string rtn has 124 nulls in front of abc.
What I'd like to do is reserve a chunk of data for string since I know ahead of
time approximately how
big it's going to be. How do you do it?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: STL string::reserve(size_t)
1999-05-11 11:18 STL string::reserve(size_t) ecmorgan
@ 1999-05-17 1:14 ` Alexandre Oliva
1999-05-31 21:36 ` Alexandre Oliva
1999-05-31 21:36 ` ecmorgan
1 sibling, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 1999-05-17 1:14 UTC (permalink / raw)
To: ecmorgan; +Cc: egcs
On May 11, 1999, ecmorgan@lucent.com wrote:
> What I'd like to do is reserve a chunk of data for string since I
> know ahead of time approximately how big it's going to be. How do
> you do it?
reserve is the way to go, but, according to you, it's not implemented
yet :-(
You may want to help the libstdc++-v3 folks, if this is not
implemented there already.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: STL string::reserve(size_t)
1999-05-17 1:14 ` Alexandre Oliva
@ 1999-05-31 21:36 ` Alexandre Oliva
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 1999-05-31 21:36 UTC (permalink / raw)
To: ecmorgan; +Cc: egcs
On May 11, 1999, ecmorgan@lucent.com wrote:
> What I'd like to do is reserve a chunk of data for string since I
> know ahead of time approximately how big it's going to be. How do
> you do it?
reserve is the way to go, but, according to you, it's not implemented
yet :-(
You may want to help the libstdc++-v3 folks, if this is not
implemented there already.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
^ permalink raw reply [flat|nested] 4+ messages in thread
* STL string::reserve(size_t)
1999-05-11 11:18 STL string::reserve(size_t) ecmorgan
1999-05-17 1:14 ` Alexandre Oliva
@ 1999-05-31 21:36 ` ecmorgan
1 sibling, 0 replies; 4+ messages in thread
From: ecmorgan @ 1999-05-31 21:36 UTC (permalink / raw)
To: egcs
I'm currently using egcs 1.1.2 on sparc-sun-solaris2.5.1
I noticed that for the egcs STL library for basic_string, the function
basic_string::reserve is empty.
void reserve (size_type) { }
When I tried to use resize(size_type), both the reserve and the length changes.
In other words, if I have the
following lines:
string rtn;
rtn.resize(124);
rtn+="abc";
When I call resize(124), my reserve size is 128 and the length is 124. When I
append "abc" to rtn,
the length is 127 and the string rtn has 124 nulls in front of abc.
What I'd like to do is reserve a chunk of data for string since I know ahead of
time approximately how
big it's going to be. How do you do it?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-05-31 21:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-11 11:18 STL string::reserve(size_t) ecmorgan
1999-05-17 1:14 ` Alexandre Oliva
1999-05-31 21:36 ` Alexandre Oliva
1999-05-31 21:36 ` ecmorgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).