requesting help for g++/gcc v3.2 on redhat Linux8.0.
John Love-Jensen
eljay@adobe.com
Tue Dec 10 05:13:00 GMT 2002
Hi Ramu,
>#1 requesting help for g++/gcc v3.2 on redhat Linux8.0(intel).
A vector<a*>::iterator is not compatible with a vector<b*>::iterator. There
are no casts to convert these UDTs from one to the other.
It fails the same way that this fails:
void foo(auto_ptr<a> value);
int main() {
auto_ptr<b> ptr(new b);
foo(ptr);
}
What should be done in my example is:
int main() {
auto_ptr<a> ptr(new b);
foo(ptr);
}
What you need in your example is:
int main() {
vector<a*> v; // Really contains b* pointers (?).
vector<a*>::iterator listiterator;
listiterator = v.begin();
a* aptr = *listiterator;
b& bobj = dynamic_cast<b&>(*a);
}
>#2 Also, what is the option on gcc for: "Turns on newly supported ANSI C++
Standard features like namespace std and the new C++ Standard Library"?
They are on by default with GCC 3.2.
--Eljay
More information about the Gcc-help
mailing list