Is there standard structure or library in C++ (or C++11) that is something like like a set
, but that could have more than one key
.
i.e. a set of std::pair that can be looked up fast by either a
or b
.
So you could do something like this:
std::string a = "hello";
std::string b = "world";
x.insert(a, b);
x.get<1>("hello") => std::pair("hello", "world"); // (fast lookup)
x.get<2>("world") => std::pair("hello", "world"); // (fast lookup)
Basically like a database table with two indexes.
I'd rather not re-invent the wheel if something already exists.
A simple way to combine existing containers to make something with this functionality would be good also.