This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE:problems using vector in gcc3.2 on Redhat linux8.0
- From: "RAMU MEDA (HP INDIA ,Bangalore)" <mramu at india dot hp dot com>
- To: <phrm at pisem dot net>
- Cc: <mramirez at iua dot upf dot es>, <gcc-help at gcc dot gnu dot org>
- Date: Tue, 10 Dec 2002 15:53:09 +0530
- Subject: RE:problems using vector in gcc3.2 on Redhat linux8.0
- Reply-to: <mramu at india dot hp dot com>
Hi,
I am also having the same problem using vector in gcc3.2 on Redhat linux8.0.
I want to type cast parent vector class iterator to child vector class
iterator...
(The piece of code works without any warnings or errors on gcc v2.96 on
redaht linux)
Can You please suggest some solution.
piece of code:
===================test.cpp====================
#include <vector>
using namespace std;
class a
{
};
class b : public a
{
};
int main()
{
vector<b*>::iterator ListIterator;
vector<a*> a;
ListIterator=(b**)(a.begin());
}
==============================================
Errors for g++ test.cpp
================================================
test.cpp: In function `int main()':
test.cpp:18: cannot convert `std::vector<_Tp, _Alloc>::begin() [with _Tp =
a*,
_Alloc = std::allocator<a*>]()' from type
`__gnu_cxx::__normal_iterator<a**,
std::vector<a*, std::allocator<a*> > >' to type `b**'
================================================
Regards,
Ramu Meda
29, Hewlett Packard ISO
Cunningham Road, Bangalore
Phone (o): (91) (80) 2051181 (Direct)
Email (p) : ramumeda@yahoo.com