How do I check if one vector is a subset of another?
问题 Currently, I think my best option is to use std::set_intersection, and then check if the size of the smaller input is the same as the number of elements filled by set_intersection. Is there a better solution? 回答1: Try this: if (std::includes(set_one.begin(), set_one.end(), set_two.begin(), set_two.end())) { // ... } About includes(). The includes() algorithm compares two sorted sequences and returns true if every element in the range [start2, finish2) is contained in the range [start1,