정등혁
정등혁

Reputation: 5

what is c++ std::unordered_map default container?

I'm studying about inside logic of unordered_map.

And found that It uses container. And uses key values to find value.

Is the default container of unordered_map std::vector??

And is other containers, for example std::map is able?

Upvotes: 0

Views: 126

Answers (1)

StPiere
StPiere

Reputation: 4243

unordered_map is implemented via hash table, so there is no such thing here as "default container". Signature:

template<
    class Key,
    class T,
    class Hash = std::hash<Key>,
    class KeyEqual = std::equal_to<Key>,
    class Allocator = std::allocator< std::pair<const Key, T> >
> class unordered_map;

The only "defaulted" types here are key hash function, key comparator and allocator.

If you mean the container for holding the buckets, its normally just raw BucketType*

Upvotes: 1

Related Questions