STL remove compile error

Discussion in 'C++' started by silverburgh.meryl@gmail.com, Jan 29, 2006.

  1. Guest

    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
    , Jan 29, 2006
    #1
    1. Advertising

  2. wrote:
    > 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
    --
    Please remove capital As from my address when replying by mail
    Victor Bazarov, Jan 29, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    541
  2. Tashfeen Bhimdi
    Replies:
    6
    Views:
    2,629
    Alf P. Steinbach
    Oct 11, 2006
  3. Nagaraj
    Replies:
    1
    Views:
    841
    Lionel B
    Mar 1, 2007
  4. fAnSKyer
    Replies:
    2
    Views:
    518
    Alf P. Steinbach
    Jun 7, 2009
  5. JetSet Willy
    Replies:
    3
    Views:
    565
    arjunaw
    Aug 12, 2010
Loading...

Share This Page