fork download
  1. #include <iostream>
  2. #include <unordered_map>
  3. #include <functional>
  4.  
  5. using namespace std;
  6.  
  7. struct Component
  8. {
  9. size_t id;
  10. };
  11.  
  12. namespace std
  13. {
  14. template<>
  15. struct hash<reference_wrapper<Component>>
  16. {
  17. size_t operator()(const reference_wrapper<Component>& cmp) const
  18. {
  19. return cmp.get().id;
  20. }
  21. };
  22. }
  23.  
  24. unordered_map<reference_wrapper<Component>, int> mapping;
  25.  
  26. int main() {
  27. // your code goes here
  28. return 0;
  29. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty