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

Return const-reference instead of value from read-accessor operator[] #156

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

fknorr
Copy link
Contributor

@fknorr fknorr commented Dec 14, 2022

This becomes visible when trying to take the address of a buffer element.

@fknorr fknorr self-assigned this Dec 14, 2022
Copy link

@BlackMark29A BlackMark29A left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a value instead of a const-reference from an index operator seems strange to me in the first place. So unless there was a particular reason why this was done I would say changing it to const-reference is the correct thing to do.

@fknorr
Copy link
Contributor Author

fknorr commented Dec 15, 2022

I believe it was simply a typo. SYCL also mandates references in the return type: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_interface_for_buffer_command_accessors

@psalz psalz merged commit 5011ded into master Jan 16, 2023
@psalz psalz deleted the accessor-cref branch January 16, 2023 12:50
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