unable to apply std::set_intersection on different types of structs with a common field

前端 未结 3 556
南方客
南方客 2021-01-12 14:57

I am trying to use use std::set_intersection to find common elements between 2 completely different types of data structures that have a common binding \'na

3条回答
  •  悲&欢浪女
    2021-01-12 15:12

    use std::copy_if and lambda that searches inside vectorB using std::binary_search be sure to sort using the same predicate you will give to binary_search

    this solves similar problem: elegant way to remove all elements of a vector that are contained in another vector?

提交回复
热议问题