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] |
| Other format: | [Raw text] | |
I have a little problem with polymorphism and vectors.This mailing list is for the development OF libstdc++, not WITH, so you shouldn't really be mailing here unless you think you've found a bug in the library. gcc-help (or a newsgroup, such as comp.lang.c++) would be more approriate. However, I'll answer your question anyway :)
------------------------------------------------------------------------Here you are asking for the type of a pointer to base, and so thats what you get!
...
vector<base*> vect; ... for (vector<base*>::iterator it = vect.begin(); it != vect.end(); it++) { cout << typeid(*it).name() << endl; }
...>...
vector<base> v2;
for (vector<base>::iterator it = v2.begin();
it != v2.end(); it++) {
cout << typeid(*it).name() << endl;
}
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |