Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Add Span.IndexOfAny overload #1293

Closed
ahsonkhan opened this issue Mar 10, 2017 · 2 comments
Closed

Add Span.IndexOfAny overload #1293

ahsonkhan opened this issue Mar 10, 2017 · 2 comments

Comments

@ahsonkhan
Copy link
Member

ahsonkhan commented Mar 10, 2017

Span.IndexOfAny(Span<byte> span, byte value)

@davidfowl, should the signature take a Span value instead, i.e.
Span.IndexOfAny(Span<byte> span, Span<byte> values)?

Note, we don't need index/count as initially requested:
Span.IndexOfAny(Span<byte> span, byte value, int index, int count)

@benaadams
Copy link
Member

benaadams commented Mar 13, 2017

should the signature take a Span value instead

Its introducing an unnecessary for loop into the implementation to be general case; would be better to use Span<byte> values as a params type overload; so:

Span.IndexOf(Span<byte> span, byte value)
Span.IndexOfAny(Span<byte> span, byte value1, byte value2)
Span.IndexOfAny(Span<byte> span, byte value1, byte value2, byte value3)
Span.IndexOfAny(Span<byte> span, Span<byte> values)

@ahsonkhan
Copy link
Member Author

Fixed in dotnet/corefx#17357

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants