Conversation
std::span is a really weird thing, behaving like a view of a contiguous range (except that it sometimes doesn't actually model the `view` concept), but built using C++17-era idioms rather than the shiny new ranges stuff, and living in a completely different section of the standard. This implementation of span is based on my own from https://github.com/tcbrindle/span, but simplified by assuming C++17 support and removing all the custom bounds-checking macro stuff -- this implementation just use uses plain old assert(). I believe it to be conforming to the current (pre-Belfast) working draft. The tests are taken (as usual) from CMCSTL2, which in turn took them from the Microsoft GSL span implementation. I have modified them to remove/comment out various things which fail -- correctly, I think? -- due to the numerous changes span has undergone during its many visits to L(E)WG.
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.
std::spanis a really weird thing, behaving like a view of a contiguous range (except that it sometimes doesn't actually model theviewconcept), but built using C++17-era idioms rather than the shiny new ranges stuff, and living in a completely different section of the standard.This implementation of span is based on my own from https://github.com/tcbrindle/span, but simplified by assuming C++17 support and removing all the custom bounds-checking macro stuff -- this implementation just use uses plain old assert(). I believe it to be conforming to the current (pre-Belfast) working draft.
The tests are taken (as usual) from CMCSTL2, which in turn took them from the Microsoft GSL span implementation. I have modified them to remove/comment out various things which fail -- correctly, I think? -- due to the numerous changes span has undergone during its many visits to L(E)WG.