The map and set classes allow you to find objects quickly, and this is facilitated by these classes holding the items in a sorted order. If you iterate through the items (from begin to end), then you will get those items in the sorted order. If you want a selection of objects within a range of the key values, you can make calls to the lower_bound and upper_bound methods, to get iterators to the appropriate ranges of keys.
This are two important features of these associative containers: lookup and sorting. In some cases the actual order of the values is not important, and the behavior you want is efficient lookup. In this case, you can use the unordered_ versions of the map and set classes. Since the order is unimportant, these are implemented using a hash table.