Clarification on comptime meta-programming

I’ve detailed how I dealt with the issue in this thread . The trick to using comptime pointers go as follows:

  • Use them in comptime code only (no intermixing with runtime code)
  • Generate a pointer-free structure from your pointer-bearing structure when your comptime code is done (dynamically define a struct with a fixed-length array based on the length of a slice)
  • Duck-type the comptime argument in your runtime function (i.e. use anytype)
2 Likes