@TypeOf and Type Reflection
Inspect types to stay generic.
Asking About Types
Generic code often needs to know the type of a value without you spelling it out. Zig answers that with the built-in @TypeOf. 🔍
@TypeOf Returns a Type
Give @TypeOf one or more expressions and it returns their type, computed entirely at compile time.
const T = @TypeOf(value);All lessons in this course
- Functions That Take a Type
- Generic Data Structures
- @TypeOf and Type Reflection
- anytype Parameters