I call a method which returns std::set where T is a class type. What I\'m trying to achieve is to check whether the set contain
When faced to such problems, I usually maintain:
std::deque or std::vector of carsstd::multiset of pointers to cars, sorted by the property value.I carefully hide those containers inside a class which allows me to insert cars.
The querying interface may vary, but usually, you make advantage of multiset::equal_range, std::sort and std::set_intersection.
If you want a red Volvo whatever... car, you
equal_range all the red cars, giving you an iterator pairequal_range all the Volvo cars, giving you an iterator pairset_intersection into a std::deque.Another way is to store the cars into a deque, enumerate them and pick the one which satisfies all your properties, using std::find. This may have worse complexity however (it depends on how many red cars you have for isntance)