Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operator[] #18

Merged
merged 3 commits into from
Dec 3, 2019
Merged

Add operator[] #18

merged 3 commits into from
Dec 3, 2019

Conversation

Neargye
Copy link
Contributor

@Neargye Neargye commented Dec 2, 2019

Thanks for the handy library!

It seems that it would be convenient to add the operator[] to access the elements. For example, std::span allows it.

@Neargye
Copy link
Contributor Author

Neargye commented Dec 2, 2019

I add tests soon.

@martinmoene
Copy link
Owner

Thanks @Neargye,

Please note that ring_span lite is modeled after proposal p0059 and models a non-owning queue, not an indexable span-like view. Hence a user-accessible operator[](ndx) or at(ndx) is not present.

So, unless the ideas in the proposal change in this respect, operator[](ndx) or at(ndx) should be offered as an extension via nsrs_RING_SPAN_LITE_EXTENSION.

Generally I try to favour extensions as a way to enable collecting experience with them.

Remember to update the Readme.

@Neargye
Copy link
Contributor Author

Neargye commented Dec 3, 2019

I have not forgotten anything? What is done:

  • Add operator[] as extension via nsrs_RING_SPAN_LITE_EXTENSION
  • Update Readme
  • Add test

@martinmoene
Copy link
Owner

martinmoene commented Dec 3, 2019

Looks good to me, will merge, when Appveyor succeeds.

@martinmoene martinmoene merged commit 5ffa2f9 into martinmoene:master Dec 3, 2019
martinmoene added a commit that referenced this pull request Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants