CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <map>
#include <unordered_map>
using namespace std;
struct test
{
test(){cout << "ctor\n";}
test(const test& ){cout << "copy ctor\n";}
test& operator= (const test& ){cout << "copy assign\n";return *this;}
bool operator<(const test& other)const{
return false;
}
bool operator==(const test& other)const{
return false;
}
};
namespace std
{
template<> struct hash<test>
{
size_t operator()(const test& t1)const
{
static int i = 0;
return ++i;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run