libstdc++-v3 useable ?

Phil Edwards pedwards@disaster.jaj.com
Fri Jan 26 11:57:00 GMT 2001


On Fri, Jan 26, 2001 at 07:24:44PM +0100, Dirk Mueller wrote:
> #include <vector.h>
> 
> int main()
> {
>   vector <char *> vszbar;
>   vector <char *>::iterator iter;
>       for (iter = vszbar.begin(); iter != vszbar.end(); iter++);
> }
> 
> does not compile.

And the error message is...?

It's snowing heavily outside, and I find that bad weather interferes with
my telepathic debugging powers.  You'll have to tell us what happens when
you try to compile, sorry.  I can't guess.


> #include <vector>
> 
> int main()
> {
>     char e;
>     std::vector <char*> foo;
>     foo.push_back(e);
> }

Ah, now here I can help you.  If you're pushing characters, then the
vector must hold characters, not pointers-to-characters.  Declare foo as
"std::vector<char>" and try that.  (Or if you really want to hold pointers,
then push a pointer; "&e" in this case.)


Phil

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.


More information about the Libstdc++ mailing list