Skip to content

Commit

Permalink
Change to west-const, since I think that's the Ports-of-Call standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanKKrueger committed Sep 13, 2024
1 parent 81f9f40 commit 1ed9372
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ports-of-call/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class span {
// object provides access to indices 2 <= i < 8 of the array my_array, but the indices
// are shifted so that sub_range[i] is my_array[i+2].
template <typename SizeType>
PORTABLE_FUNCTION constexpr span(T *ptr, SizeType const count)
PORTABLE_FUNCTION constexpr span(T *ptr, const SizeType count)
: ptr_{ptr}, size_(count) {
assert(count >= 0);
}
Expand All @@ -57,19 +57,19 @@ class span {
PORTABLE_FUNCTION constexpr T *begin() { return ptr_; }

// Iterator (really a pointer) to the beginning of the range, providing constant access.
PORTABLE_FUNCTION constexpr T const *begin() const { return ptr_; }
PORTABLE_FUNCTION constexpr const T *begin() const { return ptr_; }

// Iterator (really a pointer) to the beginning of the range, providing constant access.
PORTABLE_FUNCTION constexpr T const *cbegin() const { return ptr_; }
PORTABLE_FUNCTION constexpr const T *cbegin() const { return ptr_; }

// Iterator (really a pointer) to the end of the range, providing mutable access.
PORTABLE_FUNCTION constexpr T *end() { return ptr_ + size_; }

// Iterator (really a pointer) to the beginning of the range, providing constant access.
PORTABLE_FUNCTION constexpr T const *end() const { return ptr_ + size_; }
PORTABLE_FUNCTION constexpr const T *end() const { return ptr_ + size_; }

// Iterator (really a pointer) to the beginning of the range, providing constant access.
PORTABLE_FUNCTION constexpr T const *cend() const { return ptr_ + size_; }
PORTABLE_FUNCTION constexpr const T *cend() const { return ptr_ + size_; }

// Index operator to obtain mutable access to an element of the range.
template <typename Index>
Expand All @@ -81,7 +81,7 @@ class span {

// Index operator to obtain constant access to an element of the range.
template <typename Index>
PORTABLE_FUNCTION constexpr T const &operator[](Index const &index) const {
PORTABLE_FUNCTION constexpr const T &operator[](const Index index) const {
assert(index >= static_cast<Index>(0));
assert(index < static_cast<Index>(size_));
return *(ptr_ + index);
Expand All @@ -92,7 +92,7 @@ class span {

template <typename T, typename SizeType>
PORTABLE_FUNCTION constexpr auto make_span(T *const pointer,
SizeType const count) {
const SizeType count) {
return span<T>(pointer, count);
}

Expand Down

0 comments on commit 1ed9372

Please sign in to comment.