void Player::handleBullets(SDL_Surface *screen, Uint32 deltaTicks){
int i;
std::vector<Bullet>::reverse_iterator rii;
for(rii=bullets.begin(); rii!=bullets.end(); ++rii){
if(!*rii.move(deltaTicks)){ // Player::move() returns false if the bullet is off the screen
bullets.erase(rii);
}else{
*rri.show(screen);
}
}
}
when I try to compile it gives me this error:
../src/player.cpp: In member function ‘void Player::handleBullets(SDL_Surface*, Uint32)’: ../src/player.cpp:56: error: no match for ‘operator=’ in ‘rii = ((Player*)this)->Player::bullets.std::vector<_Tp, _Alloc>::begin [with _Tp = Bullet, _Alloc = std::allocator<Bullet>]()’ /usr/lib/gcc/i686-pc-linux-gnu/4.4.3/../../../../include/c++/4.4.3/bits/stl_iterator.h:96: note: candidates are: std::reverse_iterator<__gnu_cxx::__normal_iterator<Bullet*, std::vector<Bullet, std::allocator<Bullet> > > >& std::reverse_iterator<__gnu_cxx::__normal_iterator<Bullet*, std::vector<Bullet, std::allocator<Bullet> > > >::operator=(const std::reverse_iterator<__gnu_cxx::__normal_iterator<Bullet*, std::vector<Bullet, std::allocator<Bullet> > > >&) ../src/player.cpp:56: error: no match for ‘operator!=’ in ‘rii != ((Player*)this)->Player::bullets.std::vector<_Tp, _Alloc>::end [with _Tp = Bullet, _Alloc = std::allocator<Bullet>]()’ ../src/player.cpp:57: error: ‘class std::reverse_iterator<__gnu_cxx::__normal_iterator<Bullet*, std::vector<Bullet, std::allocator<Bullet> > > >’ has no member named ‘move’ ../src/player.cpp:58: error: no matching function for call to ‘std::vector<Bullet, std::allocator<Bullet> >::erase(std::reverse_iterator<__gnu_cxx::__normal_iterator<Bullet*, std::vector<Bullet, std::allocator<Bullet> > > >&)’ /usr/lib/gcc/i686-pc-linux-gnu/4.4.3/../../../../include/c++/4.4.3/bits/vector.tcc:133: note: candidates are: __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> > std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = Bullet, _Alloc = std::allocator<Bullet>] /usr/lib/gcc/i686-pc-linux-gnu/4.4.3/../../../../include/c++/4.4.3/bits/vector.tcc:145: note: __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> > std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer, std::vector<_Tp, _Alloc> >) [with _Tp = Bullet, _Alloc = std::allocator<Bullet>] ../src/player.cpp:60: error: ‘rri’ was not declared in this scope ../src/player.cpp:53: warning: unused variable ‘i’ make: *** [src/player.o] Error 1
BTW: the code was taken from a tutorial on vectors and modified by me, also all the functions that are called exist


Sign In
Create Account


Back to top









