[C++] error: call-to-implicitly-deleted-default-constructor _

created at 11-16-2021 views: 225

Preface

The compilation error caused when using the unordered_set container, the literal translation is to call the implicitly deleted default constructor.

unordered_map<pair<int, int>>
unordered_set<pair<int, int>>

reason

Both unordered_map and unordered_set use the default std::hash to calculate the key, and std::hash cannot handle the pair type.

solution

Use map, set instead
Custom hash function

created at:11-16-2021
edited at: 11-16-2021: