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
{{ message }}
Repository navigation
Add extension for FixedSizeArrays (collect_structarray initializer) - #344
Adding small package extension for FixedSizeArrays to provide initializer for collect_structarray to collect an iterator into a StructArray of FixedSizeArray.
I used a hack code in __init__ of the extension to export the new initializer under StructArrays module.
(The name of the initializer is still so long.)
I wonder, why does it need to live in StructArrays? The new code doesn't use any of the internals (doesn't use any code from StructArrays at all, for that matter), seems like it can just as well be independent.
Note that we don't have custom initializers for StaticArrays to be used with collect_structarray here, even though there's already an extension for StaticArrays.
I thought that StructArrayInitializer is internal API since it is not documented and that collect_structarray is a bit difficult to use as its document is not so detailed.
So is it better to add some docs to collect_structarray and StructArrayInitializer with examples on FixedSizeArray instead?
Sorry, I must've missed the StructArrayInitializer part originally :)
Why is this needed? Looking at the docs for collect_structarray, they say:
The user can optionally pass a `initializer`, that is to say
a function `(S, d) -> v` that associates to a type and a size an array of eltype `S`
and size `d`. By default `initializer` returns a `StructArray` of `Array` but custom array types
may be used.
Can initializer be just a function (S, d) -> similar(FixedSizeArrayDefault{S, length(d)}, d)?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding small package extension for FixedSizeArrays to provide
initializerforcollect_structarrayto collect an iterator into aStructArrayofFixedSizeArray.I used a hack code in
__init__of the extension to export the new initializer underStructArraysmodule.(The name of the initializer is still so long.)