|
|
@@ -22,7 +22,6 @@ |
|
|
|
extern "C++" { |
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
#include <cassert> |
|
|
|
#include <cstdlib> |
|
|
|
#include <type_traits> |
|
|
|
|
|
|
@@ -136,16 +135,25 @@ class Span : private internal::SpanBase<const T> { |
|
|
|
const T *cend() const { return end(); }; |
|
|
|
|
|
|
|
T &front() const { |
|
|
|
assert(size_ != 0); |
|
|
|
if (size_ == 0) { |
|
|
|
abort(); |
|
|
|
} |
|
|
|
return data_[0]; |
|
|
|
} |
|
|
|
T &back() const { |
|
|
|
assert(size_ != 0); |
|
|
|
if (size_ == 0) { |
|
|
|
abort(); |
|
|
|
} |
|
|
|
return data_[size_ - 1]; |
|
|
|
} |
|
|
|
|
|
|
|
T &operator[](size_t i) const { return data_[i]; } |
|
|
|
T &at(size_t i) const { return data_[i]; } |
|
|
|
T &operator[](size_t i) const { |
|
|
|
if (i >= size_) { |
|
|
|
abort(); |
|
|
|
} |
|
|
|
return data_[i]; |
|
|
|
} |
|
|
|
T &at(size_t i) const { return (*this)[i]; } |
|
|
|
|
|
|
|
Span subspan(size_t pos = 0, size_t len = npos) const { |
|
|
|
if (pos > size_) { |
|
|
|