Skip to content

Commit 62148cf

Browse files
committed
test04.cpp
1 parent 80e215a commit 62148cf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

section1/test04.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
template<int N>
1515
struct fib
1616
{
17+
static_assert(N >= 0, "N must be postive");
18+
1719
static const int value =
1820
fib<N - 1>::value + fib<N - 2>::value;
1921
};
@@ -110,6 +112,7 @@ int main()
110112

111113
cout << fib<2>::value << endl;
112114
cout << fib<3>::value << endl;
115+
cout << fib<4>::value << endl;
113116
cout << fib<5>::value << endl;
114117

115118
old_func();

0 commit comments

Comments
 (0)