-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInt2Type.cc
52 lines (47 loc) · 960 Bytes
/
Int2Type.cc
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
/*
* =====================================================================================
*
* Filename: Int2Type.cc
*
* Description:
*
* Version: 1.0
* Created: 06/26/12 23:41:51
* Revision: none
* Compiler: gcc
*
* Author: Ganesh Muniyandi (gm), [email protected]
* Company: Open Source
*
* =====================================================================================
*/
#include <iostream>
#include <map>
class MyClass {
private:
typedef std::map<int, int> MyMap;
MyMap ask;
static MyMap bid;
friend struct Int2Type;
public:
};
template<int n> struct Int2Type { };
template<>
struct MyClass::Int2Type<2>
{
typedef MyMap::iterator first;
enum { type = 2 };
};
template<>
struct MyClass::Int2Type<1> {
enum { type = 1 };
};
int main() {
enum {
A,
B
};
MyClass c;
c.Int2Type<2>::first;
return 0;
}