STL remove compile error

S

silverburgh.meryl

Hi,

I have this piece of code which calls STL remove():

_aList.erase(remove(_aList.begin(), _aList.end(), bd), _aList.end());

where _aList is a 'vector<A*>' and bd is 'A*'

But i get this compile error:

Test.cpp:199: error: no matching function for call to
'Test::remove(__gnu_cxx::__normal_iterator<A**, std::vector<A*,
std::allocator<A*> > >, __gnu_cxx::__normal_iterator<A**,
std::vector<A*, std::allocator<A*> > >, A*&)'

And I have this in my Test.cpp file:

#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;


Thanks for any help
 
V

Victor Bazarov

I have this piece of code which calls STL remove():

_aList.erase(remove(_aList.begin(), _aList.end(), bd), _aList.end());

where _aList is a 'vector<A*>' and bd is 'A*'

But i get this compile error:

Test.cpp:199: error: no matching function for call to
'Test::remove(__gnu_cxx::__normal_iterator<A**, std::vector<A*,

This suggests that the compiler is trying to resolve it to Test::remove.
Is there a 'remove' member in 'Test'? What *is* 'Test'? Why not simply
post the _entire_ code? Why do you want us to guess?

Try to write "::remove(" instead of simply "remove("... Or drop the
'using' directive and explicitly prepend all standard names with 'std::'.
std::allocator<A*> > >, __gnu_cxx::__normal_iterator<A**,
std::vector<A*, std::allocator<A*> > >, A*&)'

And I have this in my Test.cpp file:

#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

Apparently that's not enough.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top