This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libstdc++-v3 useable ?


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]