Add reverse iterators to SkSpan

Change-Id: Ie4002a97fca860f0096ad9114f707ba8476aabb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267936
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2020-01-30 17:49:40 -05:00 committed by Skia Commit-Bot
parent a90ed95d13
commit 0ee16f6898

View File

@ -31,6 +31,10 @@ public:
constexpr T* end() const { return fPtr + fSize; }
constexpr const T* cbegin() const { return fPtr; }
constexpr const T* cend() const { return fPtr + fSize; }
constexpr auto rbegin() const { return std::make_reverse_iterator(this->end()); }
constexpr auto rend() const { return std::make_reverse_iterator(this->begin()); }
constexpr auto crbegin() const { return std::make_reverse_iterator(this->cend()); }
constexpr auto crend() const { return std::make_reverse_iterator(this->cbegin()); }
constexpr T* data() const { return fPtr; }
constexpr size_t size() const { return fSize; }
constexpr bool empty() const { return fSize == 0; }