This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: requesting help for g++/gcc v3.2 on redhat Linux8.0.
- From: John Love-Jensen <eljay at adobe dot com>
- To: <mramu at india dot hp dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Tue, 10 Dec 2002 07:11:17 -0600
- Subject: Re: requesting help for g++/gcc v3.2 on redhat Linux8.0.
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