Thread: sets and do operations on them

  1. #1
    Registered User
    Join Date
    Jun 2008

    sets and do operations on them

    I try to take the difference of two sets and record the rest into another set...
    but it is giving me errors
    set<int> a,b,c;
    c = set_difference(a.begin(),a.end(),b.begin(),b.end(),c.begin());
    what should I do?

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    That last parameter needs to be std::inserter(c, c.begin()) not c.begin()
    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