I did, by stating that "it appears to be using the very property of strings being strings of characters to organise the strings into a tree structure". A
trie is "a tree for storing strings in which there is one node for every common prefix". I even suggested what you now conclude as "one way to use the algorithm for doubles would be to consider a double to be an 8 character string and use the algorithm directly".
As I noted earlier, the correct standard container for your purposes would be std::map, not std::set.
If you use std::vector, then you should only use std::sort() and not std::unique(). I gave you the std::unique() suggestion because you only mentioned counting the number of distinct elements. I do not think that there is a standard algorithm to perform the count of the distinct groups, but it does only take a single pass after the range is sorted. Ultimately, the time complexity will be the same as for std::map, so if you need something asymptotically faster, neither will suffice.