-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultimap.cpp
73 lines (60 loc) · 1.58 KB
/
multimap.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# include <iostream>
# include <map>
# include <string>
using std::cout;
using std::endl;
class totoclass {
public:
enum OptionEnum { nx, ny, nz, nxa, nxb, nyc, nyd };
typedef std::multimap<int, const char*> Options;
typedef std::pair<OptionEnum, const char* const> OptionPair;
totoclass() : SolverOption()
{
MapInit();
}
~totoclass()
{}
void listoption()
{
Options::iterator I=SolverOption.begin();
do {
cout << "enum= " << (*I).first << " name= " << (*I).second << endl;
++I;
}
while (I != SolverOption.end());
}
void listoptionkey(int key)
{
Options::iterator I=SolverOption.find(key);
do {
cout << "key= " << key << " name= " << (*I).second << endl;
++I;
}
while (I != SolverOption.upper_bound(key));
}
private :
Options SolverOption;
void MapInit()
{
SolverOption.insert(OptionPair(nx, "nx"));
SolverOption.insert(OptionPair(nx, "-nx"));
SolverOption.insert(OptionPair(ny, "ny"));
SolverOption.insert(OptionPair(ny, "-ny"));
SolverOption.insert(OptionPair(nxa, "nxa"));
SolverOption.insert(OptionPair(nxa, "-nxa"));
SolverOption.insert(OptionPair(nxb, "nxb"));
SolverOption.insert(OptionPair(nxb, "-nxb"));
SolverOption.insert(OptionPair(nyc, "nyc"));
SolverOption.insert(OptionPair(nyc, "-nyc"));
SolverOption.insert(OptionPair(nyd, "nyd"));
SolverOption.insert(OptionPair(nyd, "-nyd"));
SolverOption.insert(OptionPair(nx, "-Nx"));
}
};
int main(int argc, char *argv[])
{
totoclass toto;
toto.listoption();
toto.listoptionkey(0);
return 0;
}