| Lecture 6 - Slide 37 : 40|
Example of type function: Integer of given byte size
We show how to program a type function: Integer_of_byte_size<N>
A function from an int to some C++ integer type
- A function from int to an integer type
- Input: N (such as 0, 1, 2, 3)
- Output: A C++ integer type, such as unsigned char or short int
- The concrete mapping:
- 0 is mapped to void (it is an error)
- 1 is mapped to usigned char
- 2 is mapped to short int
- 3 is mapped to void (it is an error)
First version of type function.
Second version of type function - embellished syntax of the type function.
The ugly and bulky selection stuff.