This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

RE:problems using vector in gcc3.2 on Redhat linux8.0


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]