maple
maple

Reputation: 1894

How to insert a array into unordered set?

I want to create a tuple/array like (0,1,2), (3,4,5). I want to store it into an unordered_set. But unordered_set didn't offer such a hash function. Can anyone tell me how can I do this?

I have read thes answer: C++ how to insert array into hash set? but I don't want to add any extra code like hash function.

Upvotes: 2

Views: 4946

Answers (1)

eerorika
eerorika

Reputation: 238341

  1. I want to store [array] into an unordered_set

  2. unordered_set didn't offer such a hash function

  3. I don't want to add any extra code like hash function.

Tough luck. A hash function is mandatory. Since it's not provided by the standard library, it must be provided by you. The answer in the question you linked shows how to write a hash function for std::array.

Upvotes: 1

Related Questions