This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++-v3 useable ?
- To: Dirk Mueller <dmuell at gmx dot net>
- Subject: Re: libstdc++-v3 useable ?
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Fri, 26 Jan 2001 15:08:14 -0500
- Cc: libstdc++ at gcc dot gnu dot org
- References: <20010126192444.A16415@rotes20.wohnheim.uni-kl.de>
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.