-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
This is more of a question than an issue:
I have two tsl::ordered_map objects with the same signature, e.g. tsl::ordered_map<std::string, std::shared_ptr<MyCustomType>>
I'd like to be able to find the intersection of common keys between them. When using a std::unordered_map, I can use the ranges-v3 library to do this:
std::unordered_map<std::string, std::shared_ptr<MyCustomType>> = { {"key1", ...}, {"key2", ...} };
std::unordered_map<std::string, std::shared_ptr<MyCustomType>> = { {"key3", ...}, {"key2", ...} };
const auto common_keys =
ranges::views::set_intersection(cfg1 | ranges::views::keys, cfg2 | ranges::views::keys);
// common_keys will contain "key2"
When I do the same with a tsl::ordered_map then common_keys is empty. This makes sense per the readme indicating that insertion order matters for the equality operator. The question then is, how would I achieve the above?
Metadata
Metadata
Assignees
Labels
No labels