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>
using namespace std;
#define TTMAP map<Test,Test>
struct Test
{
int a;
Test(int a = 0):a(a){/*cout<<"C "<<a<<"\n";*/}
bool operator<(const Test& t) const
{
return a < t.a;
}
friend ostream& operator<<(ostream& os, const Test& t){
os << "Test(" << t.a <<")";
return os;
}
~Test(){/*cout<<"D "<<a<<"\n";*/}
};
int main(){
TTMAP mp1{{Test(1),Test(10)}};
TTMAP mp2{{Test(20),Test(20)}};
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run