Add Memory3D<T> and Span3D<T>#1163
Open
Ethereal77 wants to merge 9 commits intoCommunityToolkit:mainfrom
Open
Conversation
* Span3D<T> and ReadOnlySpan3D<T> * Ref-Enumerators for both * Memory3D<T> and ReadOnlyMemory3D<T>
* They mimic the tests that already exist for Memory2D<T> and Span2D<T>
* To complement the new functionality of Memory3D<T> and Span3D<T>
* To be more in line with what the tests for 2D array extensions do
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
** Closes #723 **
This pull request adds four new types (
Span3D<T>andMemory3D<T>, and their read-only counterparts) to allow working with 3D / volumetric data more confortably, as well as adding related extensions for arrays and spans to more easily interoperate with these new types and 3D indexing semantics.Span3D<T>,ReadOnlySpan3D<T>,Memory3D<T>, andReadOnlyMemory3D<T>.AsSpan3DandAsMemory3Dextension methods forT[,,]arrays.AsMemory3Dextension methods forMemory<T>andReadOnlyMemory<T>.AsSpan3Dextension methods forSpan<T>andReadOnlySpan<T>.GetRow,GetColumn, andGetDepthColumnextension methods forT[,,]arrays, and as part of the new types, allowing efficient enumeration of 3D array rows, columns, and depth columns viaRefEnumerable<T>orReadOnlyRefEnumerable<T>.GetRowSpanandGetRowMemorymethods to retrieve aSpan<T>orMemory<T>over a specific row in a 3D array.There are also new tests that covers every new type and functionality, mimicking as close as possible the tests already existing for the 2D methods/types already in the library.
PR Checklist
Other information
Currently, the PR builds succesfully, and tests pass. There is some things I would like to discuss prior to consider this complete:
ParallelHelper. I presume this is out of scope, and matter for another PR too.