Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use Span<T> for APIs#285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Marioalexsan wants to merge1 commit intoSFML:master
base:master
Choose a base branch
Loading
fromMarioalexsan:feature/span

Conversation

@Marioalexsan
Copy link
Member

Supersedes#263.

To recap, what we want to do is:

  • Multitarget .NET Standard 2.0 and .NET Standard 2.1, and install System.Memory on NS2.0 to gain access to Span there
  • Replace T[] with Span in input parameters where possible - this is a trivial change that just allows slicing
  • Replace T[] returns with Span where possible (i.e. when we want to just give a view into memory) - this reduces the number of allocations and solves some anti-patterns like Image.Pixels
  • Prefer ReadOnlySpan over Span where possible

In some cases, the implementation has to be split in NS2.0 and NS2.1 specific sections to be able to use Span-enhanced methods from .NET. One such example is in StreamAdaptor's Read method, where you can read directly into a Span on NS2.1.

Things to consider:

  • Spans must be used carefully with memory that can get invalidated from the C/C++ side, so we have to make sure that such memory will never be freed / moved for places where we just take the pointers and convert them to spans

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@Marioalexsan

[8]ページ先頭

©2009-2025 Movatter.jp