Is it possible to know (without iterating ofcourse) how many unique keys are in a multiset? I know that a set has unique values, but I would prefer using multiset in my solution if I have the unique keys counting solution.
Example:
Given a multiset with values: {1,1,2,4,5,4,3,1} - The unique counting will give me 5 for {1,2,3,4,5} keys.
A indirect solution may be adding the multiset items to a set and then get the set size.. But I wonder if there is a direct way of getting the unique items number.