C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
chapter-4-undefined_bool.hpp
Go to the documentation of this file.
1// ===-- chapter-4/chapter-4-undefined_bool.hpp ----------- -*- C++ -*- --=== //
13#ifndef CHAPTER_4_UNDEFINED_BOOL
14#define CHAPTER_4_UNDEFINED_BOOL
15
16
19namespace chapter4 {
20
25template <bool B> struct undefined_false;
26
28template <> struct undefined_false<true>
29{
30 static bool const value = true;
32};
33
34
38template <bool B> struct undefined_true;
39
41template <> struct undefined_true<false>
42{
43 static bool const value = false;
45};
46
47} // namespace chapter4
48
49#endif // CHAPTER_4_UNDEFINED_BOOL
Provide utilities availble to all Chapter 4 solutions.
If the template parameter is false, template instantiation is an error.
If the template parameter is true, template instantiation is an error.