-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInlineNspace.cpp
57 lines (40 loc) · 1.12 KB
/
InlineNspace.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
inline namespace V2_00 {}
namespace V2_00 {
struct Hit;
}
namespace V1_00 {
struct Hit {
Hit(){}
Hit(int iid, float it): id(iid), time(it){}
Hit(V2_00::Hit const & newer);
int id;
float time;
};
}
namespace V2_00 {
struct Hit {
Hit(){}
Hit(int iid, int it, int iq): id(iid), time(it), qual(iq){}
Hit(V1_00::Hit const & old);
int id;
int time;
int qual;
};
}
V2_00::Hit::Hit(V1_00::Hit const & old) : id(old.id), time(100.f*(old.time)), qual(-1){}
V1_00::Hit::Hit(V2_00::Hit const & newer) : id(newer.id), time(0.01f*float(newer.time)) {}
#include <iostream>
#include <typeinfo>
int main() {
std::cout << typeid(Hit).name() << std::endl;
std::cout << typeid(V1_00::Hit).name() << std::endl;
std::cout << typeid(V2_00::Hit).name() << std::endl;
Hit h;
std::cout << typeid(h).name() << std::endl;
V1_00::Hit old(2,3.14);
Hit curr(old);
V1_00::Hit back(curr);
std::cout << old.id << ", " << old.time << std::endl;
std::cout << curr.id << ", " << curr.time << ", " << curr.qual << std::endl;
std::cout << back.id << ", " << back.time << std::endl;
}