|
C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
Encapsulate solution for Exercise 2-4. More...
Namespaces | |
| namespace | cpp20 |
| Encapsulate solution for Exercise 2-4 (C++20). | |
Classes | |
| struct | type_descriptor |
| Print (a limited set of) data-types. More... | |
Functions | |
| template<typename T > | |
| consteval T * | error_unhandled_type () |
| Produce a compile-time failure for an "unhandled" type. | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T > const &) |
| template<typename T > | |
| consteval T * | error_unhandled_type () |
| Produce a compile-time failure for an "unhandled" type. | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T const > const &) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T & > const &) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T * > const &) |
| template<typename T , size_t N> | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T[N]> const &) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T()> const &) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< T(*)()> const &) |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< char > const &) |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< short > const &) |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< int > const &) |
| std::ostream & | operator<< (std::ostream &os, type_descriptor< long > const &) |
Encapsulate solution for Exercise 2-4.
| consteval T * exercise_2_4::error_unhandled_type | ( | ) |
Produce a compile-time failure for an "unhandled" type.
The purpose of this is to induce a compilation error that indicates the type (T) that was not handled in the constexpr-if cases for operator<<.
| T | The type that was "unhandled." |
nullptr. Definition at line 19 of file c++20/exercise-2-5.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< char > const & | |||
| ) |
Definition at line 91 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< int > const & | |||
| ) |
Definition at line 95 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< long > const & | |||
| ) |
Definition at line 97 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< short > const & | |||
| ) |
Definition at line 93 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T & > const & | |||
| ) |
Definition at line 62 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T * > const & | |||
| ) |
Definition at line 67 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T const > const & | |||
| ) |
Definition at line 57 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T()> const & | |||
| ) |
Definition at line 77 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T(*)()> const & | |||
| ) |
Definition at line 82 of file exercise-2-4.hpp.
| std::ostream & exercise_2_4::operator<< | ( | std::ostream & | os, |
| type_descriptor< T[N]> const & | |||
| ) |
Definition at line 72 of file exercise-2-4.hpp.