c++ - Compare two std::list lists and get different objects -
is there ready function difference of 2 std::list lists?
for example have list1: obj1, obj2, obj3, obj4 , list2: obj2, obj3, obj4, obj5.
the function result should list1_unique: obj1, list1_and_list2: obj2, obj3, obj4, list2_unique: obj5.
(it's not hard write own implementation prefer standard function)
if lists sorted (as examples appear be), std::set_difference list1_unique , list2_unique, , std::set_intersection list1_and_list2. if they're not sorted, sort them std::list::sort().
Comments
Post a Comment