Skip to content

Commit 1a49825

Browse files
committed
compile.cpp
1 parent 686cb2e commit 1a49825

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

section1/compile.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
//
88
// gcc -E -dM - < /dev/null
99

10+
#include <cassert>
11+
1012
#include <typeinfo>
13+
#include <string>
1114
#include <iostream>
1215
#include <stdexcept>
1316
#include <type_traits>
@@ -107,6 +110,18 @@ void check_type(T v)
107110
cout << is_void<void>::value << endl;
108111
}
109112

113+
void case5()
114+
{
115+
int i = 10;
116+
int *p = &i;
117+
118+
assert(i > 0 && "i must be greater than zero");
119+
assert(p != nullptr);
120+
121+
std::string str = "hello";
122+
assert(!str.empty());
123+
}
124+
110125
int main()
111126
{
112127
using namespace std;
@@ -123,6 +138,7 @@ int main()
123138
case3();
124139

125140
case4();
141+
case5();
126142

127143
check_type(10);
128144
//check_type((void*)0);

0 commit comments

Comments
 (0)