This repository was archived by the owner on Jan 23, 2023. It is now read-only.
added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API#7220
Merged
janvorli merged 2 commits intodotnet:SpanOfTfrom Sep 16, 2016
Merged
added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API#7220janvorli merged 2 commits intodotnet:SpanOfTfrom
janvorli merged 2 commits intodotnet:SpanOfTfrom
Conversation
jkotas
reviewed
Sep 16, 2016
src/mscorlib/src/System/Span.cs
Outdated
| where T : struct | ||
| { | ||
| if (JitHelpers.ContainsReferences<T>()) | ||
| return Span<byte>.Empty; |
Member
There was a problem hiding this comment.
I do not think this should return empty span - it should throw instead.
Member
Author
|
@KrzysztofCwalina @jkotas I have update the code |
Member
|
LGTM |
Member
|
looks good. |
Member
|
Can we keep the 2 Span implementations in sync (API surface etc)? |
Member
Author
@davidfowl That's the goal, but I am not sure what's the best way to achieve it. Maybe we should sync all the changes when branch SpanOfT gets merged into master? And then ask people to sync it with every change? |
Member
I'm pretty sure this isn't getting merged back into master anytime soon, but I might be wrong 😄 |
jkotas
pushed a commit
to jkotas/coreclr
that referenced
this pull request
Oct 29, 2016
…otnet#7220) * added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API, fixes #7211 * throw when casted types contain pointers
jkotas
pushed a commit
to jkotas/coreclr
that referenced
this pull request
Oct 29, 2016
…otnet#7220) * added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API, fixes #7211 * throw when casted types contain pointers
jkotas
pushed a commit
to jkotas/coreclr
that referenced
this pull request
Oct 29, 2016
…otnet#7220) * added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API, fixes #7211 * throw when casted types contain pointers
jkotas
pushed a commit
to jkotas/coreclr
that referenced
this pull request
Oct 29, 2016
…otnet#7220) * added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API, fixes #7211 * throw when casted types contain pointers
jkotas
pushed a commit
to jkotas/coreclr
that referenced
this pull request
Oct 31, 2016
…otnet#7220) * added AsBytes() and NonPortableCast() to Span and ReadOnlySpan API, fixes #7211 * throw when casted types contain pointers
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
I took the tests from corefxlab repo.
I was not sure what should I do when
Tcontains pointers so I decided to follow the corefxlab way: return empty span.@KrzysztofCwalina @jkotas Please take a look