// Get input item multiset std::vector inp_names = craftGetItemNames(input.items, gamedef); std::multiset inp_names_multiset = craftMakeMultiset(inp_names); // Get recipe item multiset std::vector rec_names = craftGetItemNames(recipe, gamedef); std::multiset rec_names_multiset = craftMakeMultiset(rec_names); // Recipe is matched when the multisets coincide return inp_names_multiset == rec_names_multiset;