-
Notifications
You must be signed in to change notification settings - Fork 407
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
Adding data() to Vector. #3123
Adding data() to Vector. #3123
Conversation
|
Addresses issue kokkos#3077
@@ -221,6 +221,8 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> { | |||
size_type span() const { return DV::span(); } | |||
bool empty() const { return _size == 0; } | |||
|
|||
iterator data() const { return DV::h_view.data(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you update the Synopsys in the API reference accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions on this:
Shouldn't data()
return pointer
, not iterator
? I know they are the same type in this implementation, but not in general.
Why aren't there pairs of functions for this, with the following signatures:
iterator begin()
const_iterator begin() const
iterator end()
const_iterator end() const
pointer data()
const_pointer data() const
reference operator[](int)
const_reference operator[](int) const
reference operator()(int)
const_reference operator()(int) const
It is already that way for front()
and back()
, but not for the above functions.
Addresses issue #3077