-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (62 loc) · 2.3 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (62 loc) · 2.3 KB
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
74
75
76
#include <iostream>
#include <string>
#include <cassert>
#include "SomeClass.hpp"
int main(int argc, char** argv) {
std::cout << "Hello, World!" << std::endl;
{
SomeClass s;
{
const auto alwaysWorks = (std::chrono::time_point<std::chrono::system_clock>)s.property;
const std::chrono::time_point<std::chrono::system_clock> castCannotBeExplicit = s.property;
}
std::cout << " -- 1 -- " << std::endl;
std::cout << (std::string)s.property << std::endl;
std::cout << (unsigned)s.property << std::endl;
assert((std::string)s.property == "Jan 01 1970 01:00:00");
assert((unsigned)s.property == 0);
s.property = "Jan 9 2014 12:35:34";
std::cout << " -- 2 -- " << std::endl;
std::cout << (std::string)s.property << std::endl;
std::cout << (unsigned)s.property << std::endl;
assert((std::string)s.property == "Jan 09 2014 12:35:34");
assert((unsigned)s.property == 1389267334);
s.property = std::chrono::time_point<std::chrono::system_clock>{};
std::cout << " -- 3 -- " << std::endl;
std::cout << (std::string)s.property << std::endl;
std::cout << (unsigned)s.property << std::endl;
assert((std::string)s.property == "Jan 01 1970 01:00:00");
assert((unsigned)s.property == 0);
s.property = 10;
std::cout << " -- 4 -- " << std::endl;
std::cout << (std::string)s.property << std::endl;
std::cout << (unsigned)s.property << std::endl;
assert((std::string)s.property == "Jan 01 1970 01:00:10");
assert((unsigned)s.property == 10);
//std::cout << (int)s.property << std::endl;
}
std::cout << "Bye." << std::endl;
return 0;
}
#include "Simple.hpp"
int main_simple(int argc, char** argv) {
std::cout << "Hello, World!" << std::endl;
{
Simple s{"Hello"};
std::cout << s << std::endl;
// s.value = "s";
// s.reader = "s";
s.writer = "s";
std::cout << s << std::endl;
}
{
const std::string str{"boo"};
Simple sr{str};
std::cout << sr << std::endl;
sr.writer = "s";
std::cout << sr << std::endl;
std::cout << str << std::endl;
}
std::cout << "Bye." << std::endl;
return 0;
}