adding front and back

This commit is contained in:
Jordan Maples [MSFT]
2019-11-19 16:03:55 -08:00
parent 7e99e76c97
commit 7004ef506c
2 changed files with 27 additions and 1 deletions
+13
View File
@@ -512,6 +512,19 @@ public:
constexpr reference at(index_type idx) const { return this->operator[](idx); }
constexpr reference operator()(index_type idx) const { return this->operator[](idx); }
constexpr reference front() const
{
Expects(size() > 0);
return data()[0];
}
constexpr reference back() const
{
Expects(size() > 0);
return data()[size() - 1];
}
constexpr pointer data() const noexcept { return storage_.data(); }
// [span.iter], span iterator support