Add const getData methods to Vector class#412
Merged
Conversation
Collaborator
|
You actually read my mind on this - I was going to ask you about this exact problem. |
alexander-novo
approved these changes
Feb 26, 2026
Collaborator
Author
It's been on our to-do list for a while. Thanks for your initiative! |
shakedregev
reviewed
Feb 26, 2026
Collaborator
shakedregev
left a comment
There was a problem hiding this comment.
Looks good, testing before approving.
shakedregev
approved these changes
Feb 26, 2026
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.
Description
Add const methods to access raw vector data. Non-constant vector data getters are syncing data between host and device as needed. While convenient in some instances, these methods are changing member data in
Vector, so calling them prevents passing cont references to theVectorobject.We should probably do away with "sloppy" syncing altogether. This PR is a first step to enable using const references to
Vectorobjects.Proposed changes
Implements following methods to
vector::Vectorclass:Checklist
make testandmake test_installper testing instructions). Code tested on./examples/<your_example>.exe -hto get instructions how to run examples). Code tested on:-Wall -Wpedantic -Wconversion -Wextra.Further comments