Compare two vectors C++

后端 未结 4 1158
忘掉有多难
忘掉有多难 2020-12-13 20:37

I was wondering is there any function to compare 2 string vectors to return the number of different(or the same) elements? Or i have to iterate over both of them and test it

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 20:59

    Have a look at set_difference() and set_intersection(). In both cases you need to have your containers sorted beforehand.

提交回复
热议问题