Thread: no match for operator =

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    40

    no match for operator =

    I am facing below error at highlighted line

    Code:
         while (iter != dcFacMap.end())
            {
                    FacilityId facId = iter->first->GetFacilityId();
                    vector<FacilityId>::iterator facIter = find(oFacIdList.begin(),
                            oFacIdList.end(), facId);
                    if (facIter == oFacIdList.end())
                    {
                            //DC has no outbound
                            iter = dcFacMap.erase(iter);
                    }
                    else
                    {
                            iter++;
                    }
            }
    error:
    FleetRouteGenManager.cpp:5774: error: no match for âoperator=â in âiter = ((SequencedFacilityMap*)dcFacMap)->std::map<_Key, _Tp, _Compare, _Alloc>::erase [with _Key = Facility*, _Tp = std::vector<Facility*, std::allocator<Facility*> >, _Compare = std::less<Facility*>, _Alloc = std::allocator<std::pair<Facility* const, std::vector<Facility*, std::allocator<Facility*> > > >](iter)â
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:152: note: candidates are: std::_Rb_tree_iterator<std::pair<Facility* const, std::vector<Facility*, std::allocator<Facility*> > > >& std::_Rb_tree_iterator<std::pair<Facility* const, std::vector<Facility*, std::allocator<Facility*> > > >::operator=(const std::_Rb_tree_iterator<std::pair<Facility* const, std::vector<Facility*, std::allocator<Facility*> > > >&)
    Last edited by vaibhavs17; 03-30-2009 at 06:19 AM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So you haven't got an iterator copy constructor.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    40
    I could not understand, please explain.

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    map::erase might not return an iterator, although this can vary between implementations
    Last edited by anon; 03-30-2009 at 11:12 AM.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by matsp View Post
    So you haven't got an iterator copy constructor.

    --
    Mats
    Nah he's got the copy-constructor, otherwise the line with the find would fail to compile.
    That line is doing assignment anyway. Probably missing the assignment operator.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-30-2009, 06:37 PM
  2. no match for 'operator>>'
    By Taka in forum C++ Programming
    Replies: 3
    Last Post: 03-30-2009, 12:17 AM
  3. No Match For Operator+ ???????
    By Paul22000 in forum C++ Programming
    Replies: 24
    Last Post: 05-14-2008, 10:53 AM
  4. 2 array match
    By ajastru2000 in forum C++ Programming
    Replies: 5
    Last Post: 07-18-2003, 07:58 AM
  5. How do I match 2 files to print data.
    By sketchit in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 11-12-2001, 05:45 PM

Tags for this Thread