|
C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
Redefine the binary template to sanity-check its parameter. More...
Files | |
| file | c++20/exercise-3-0.hpp |
| Solution to Exercise 3-0 (C++20). | |
| file | exercise-3-0.hpp |
| Solution to Exercise 3-0. | |
Namespaces | |
| namespace | test_3_0 |
| Tests functionality from Exercise 3-0. | |
| namespace | exercise_3_0 |
| Encapsulate solution for Exercise 3-0. | |
| namespace | exercise_3_0::cpp20 |
| Encapsulate solution for Exercise 3-0 (C++20). | |
Redefine the binary template to sanity-check its parameter.
3-0. Use BOOST_STATIC_ASSERT to add error checking to the binary template
presented in section 1.4.1, so that binary<N>::value causes a
compilation error if N contains digits other than 0 or 1.