Is there ready function to get difference of two std::list lists?
For example I have list1: obj1, obj2, obj3, obj4 and list2: obj2, obj3, obj4, obj5.
The function result should be list1_unique: obj1, list1_and_list2: obj2, obj3, obj4, list2_unique: obj5.
(It’s not hard to write my own implementation but I would prefer standard function)
If your lists are sorted (as your examples appear to be),
std::set_differenceto getlist1_uniqueandlist2_unique, andstd::set_intersectionto getlist1_and_list2. If they’re not already sorted, you could sort them withstd::list::sort().