You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Struct arrays are analogous to C arrays - that is, there is no such thing as an array of undetermined length. You must either over-provision the length of your array to start with, or implement logic to expand/replace the arrays on your own. It's unlikely that the library will support such expansion logic moving forward as the means by which an array is expanded is dependent on the application itself.
Usually, expansion of an independent array is implemented by creating a new array of the desired size, copying the contents of the old array into the new one, and freeing the old array for garbage collection. Alternately, you can create a new array separately and use logic to create something of a "virtual index" that maps to the appropriate array - but you'll lose some of the performance benefits of using contiguous memory.
Changing the size of arrays within a struct at runtime is inadvisable as it will invalidate all previous instances of the struct by changing the offsets at which fields reside - so all previous instances of the struct would need to be converted each time any of their array fields grow.
Hey. What about if the structure is an array and its length is not defined? I see an option to use an array with a larger advance. Is it going to be?
The text was updated successfully, but these errors were encountered: