I need an occurrence count for each occurring value from a list of unsigned integrals. I.e. if passed the sequence [ 3, 6, 9, 3, 9 ] I would want [ { 3, 2}, {6, 1}, {9, 2} ]. 

The values are random 32 bit unsigned ints (Range of 1 to 1,000,000,000). The result can be stored in any data structure (as long as they can be iterated over linearly) and whilst value ordered would be ideal this is a secondary concern after speed.

Currently I have -

```
T UniqueCount(std::vector<unsigned> &A)
{
    std::unordered_map<unsigned,unsigned> value_counts;

    for(unsigned val : A) {
        value_counts[val]++;
    }

    A.clear();

    ...
}

```

Profiling has shown std::unordered\_map to be faster than std::map.

Is there a better approach for this? / Faster way? It is also worth noting because of the use case (count > 4) can be recorded as 4.

This is currently a bottleneck so whilst standard containers are preferred something custom can be considered if the performance boost is worth the additional maintenance cost.