I have a compound data type like:
struct Key {
optional<int> a;
optional<int> b;
optional<int> c;
};
I also have a multiset, multiset<Key>
. For example, it contains
{1, 2, 3}
{1, NULL, 3}
{NULL, 2, 3}
{NULL, NULL, 3}
I want to get all the objects in this multiset that match {1, 2, 3}
. But there is catch: NULL
fields should match with anything. For example, {1, 2, 3}
matches with {1, NULL, 3}
.
I tried to defined a comparator (<
) that ignores NULL values. For example {1, NULL, NULL} == {NULL, 2, 3}
. But it does not follow the weak strict ordering and it gives me wrong results.
How can I do that?