delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/01/13:00:50

From: authentic AT tip DOT nl (Rick)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Vectors in DJGPP ?
Date: Wed, 31 Dec 1997 17:26:01 GMT
Organization: NL-NIC
Lines: 63
Message-ID: <68gjkg$9rp$1@cadmium.aware.nl>
References: <m0xnPIj-0003qpC AT fwd10 DOT btx DOT dtag DOT de>
Reply-To: authentic AT tip DOT nl
NNTP-Posting-Host: nijmegen-025.std.pop.tip.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Stritt AT t-online DOT de (Stritt) wrote:

>Hello!

>In "normal" C++ I have a container called "Vector" which is a kind of dynamic array.

>Normaly I can do like this:

>#include <vector>
>main()
>{
>vector<int> test(10);  // allocates a array of INTs with 10 elements

>test.resize(11);  // to increase the array up to 11 elements

>test[11]=200;  // now I can write the 11th element...

>test.resize(test.size()+1);  // to increase the array 1 emement, "size()" gives the
>                             // actual element size
>[...]



>In DJGPP I can use the Include-File <vector>, then I have the container "vector" and I
>can make an vector like above.

>But: there exists no function like "resize" to resize the array, and no function like
>"size" to get the actual element size of the array.

Thats not true. cout<< test.size();
will work fine..
If resize is not a member(which btw my original STL documentation
does not mention too) then it would not be very difficult to use:
1)test.push_back(200);
2)test.insert(v.end,200);

Both will do what you want.

What remains is a design guestion. Why is pop_back in gcc implemented
as void??? Or put it another way: why not call it delete_back in that
case ??

Take care,

Rick



>Does anyone know how the functions are called in DJGPP ???



>thanks,
>mr rooTS

> 







- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019