Skip to content

Commit

Permalink
add cbegin() and cend() to Kokkos::Vector
Browse files Browse the repository at this point in the history
  • Loading branch information
shaomeng committed Mar 1, 2023
1 parent 5f8d0e3 commit b132b9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions containers/src/Kokkos_Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,16 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> {

iterator begin() const { return DV::h_view.data(); }

const_iterator cbegin() const { return DV::h_view.data(); }

iterator end() const {
return _size > 0 ? DV::h_view.data() + _size : DV::h_view.data();
}

const_iterator cend() const {
return _size > 0 ? DV::h_view.data() + _size : DV::h_view.data();
}

reference front() { return DV::h_view(0); }

reference back() { return DV::h_view(_size - 1); }
Expand Down

0 comments on commit b132b9b

Please sign in to comment.