-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
78 lines (60 loc) · 2.63 KB
/
main.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
74
75
76
77
78
#include <sstream>
#include <stdlib.h>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <list>
#include "print.hpp"
using namespace print_helper;
// static_assert(_not<std::false_type>::value, "");
// static_assert(_not<_not<std::true_type>>::value, "");
// static_assert(_and<std::true_type, std::true_type>::value, "");
// static_assert(!_and<std::false_type, std::true_type>::value, "");
// static_assert(!_and<std::false_type, std::false_type>::value, "");
// static_assert(!_is_pointer<int>::value, "");
// static_assert(_is_pointer<int*>::value, "");
// static_assert(_is_pointer<void*>::value, "");
// static_assert(!_is_std_string<int>::value, "");
// static_assert(!_is_std_string<const char*>::value, "");
// static_assert(_is_std_string<std::string>::value, "");
// static_assert(_is_std_string<std::wstring>::value, "");
// static_assert(!_is_std_string<std::vector<int>>::value, "");
static_assert(!_is_std_container<int>::value, "");
static_assert(!_is_std_container<const char*>::value, "");
// static_assert(!_is_std_container<std::string>::value, "");
static_assert(_is_std_container<std::vector<int>>::value, "");
// static_assert(_is_printable_helper<int, std::ostream>::value, "");
// static_assert(_is_printable_helper<const char*, std::ostream>::value, "");
// static_assert(_is_printable_helper<std::string, std::ostream>::value, "");
// static_assert(!_is_printable_helper<std::vector<int>, std::ostream>::value, "");
// static_assert(!is_printable_pointer<int>::value, "");
// static_assert(is_printable_pointer<const int*>::value, "");
// static_assert(!is_printable_pointer<const void*>::value, "");
// static_assert(is_opaque_pointer<const void*>::value, "");
// static_assert(!is_opaque_pointer<const int*>::value, "");
// static_assert(_is_printable<int>::value, "");
// static_assert(_is_printable<std::string>::value, "");
// static_assert(!_is_printable<bool>::value, "");
// static_assert(!_is_printable<int*>::value, "");
// static_assert(!_is_printable<std::vector<int>>::value, "");
int main()
{
int a = 456;
int* pa = &a;
int** ppa = &pa;
bool ok = true;
#ifdef _MSC_VER
println("_MSC_VER =", _MSC_VER);
#endif // _MSC_VER
println("__cplusplus =", __cplusplus);
std::map<std::string, double> dict{{"A", 1.1}, {"B", 2.2}};
println(ok, &ok);
println(123, 2.3);
println('A', "hello", std::string("world"));
println(a, pa, ppa, (double*)nullptr);
println(std::make_pair(1,2.0), std::make_pair("PI", 3.14159));
println(std::vector<int>{1, 2, 3}, std::list<std::string>{"alpha", "beta"});
println(dict, &dict, std::set<char>{'A', 'B'});
return 0;
}