Lecture 6 - Slide 30 : 40 |
static_assert is checked at compile time, whereas assert from <cassert> is checked at run time
If static_assert fails, a compiler error message will appear
![]() | Compilation of p1.cpp. |
![]() | Compilation of p4.cpp. |
![]() | Working with static_assert |
There is a lot of useful type functions in <type_traits> - see The C++ Prog. Lang. (4. edition) page 1018 - which can be used in static_assert