Relative Content

Tag Archive for zig

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?

Constant struct fields in Zig

Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows and columns fields will never change (and maybe this should be true for data too). However, my understanding is that Zig will only allow constant struct members if they are comptime. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?