diff options
author | Chris Robinson <[email protected]> | 2019-06-25 14:40:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-25 14:40:25 -0700 |
commit | edd75b3b4eb4e43f4df7dfe6470989f22e4d3bcc (patch) | |
tree | 78ddbabb932c6fde56479a5212abe425586e43f4 /common/alspan.h | |
parent | ab3c2ea777dd6a31163f0d31922004185ff8a180 (diff) |
Don't return a blank span when offset==size()
Diffstat (limited to 'common/alspan.h')
-rw-r--r-- | common/alspan.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/alspan.h b/common/alspan.h index 6b0dc7d6..b7995121 100644 --- a/common/alspan.h +++ b/common/alspan.h @@ -255,7 +255,7 @@ public: constexpr span subspan(size_t offset, size_t count=dynamic_extent) const { - return (offset >= size()) ? span{} : + return (offset > size()) ? span{} : (count >= size()-offset) ? span{mData+offset, mDataEnd} : span{mData+offset, mData+offset+count}; } @@ -282,7 +282,7 @@ constexpr inline auto span<T,E>::last(size_t count) const -> span<element_type,d template<typename T, size_t E> constexpr inline auto span<T,E>::subspan(size_t offset, size_t count) const -> span<element_type,dynamic_extent> { - return (offset >= size()) ? span<element_type>{} : + return (offset > size()) ? span<element_type>{} : (count >= size()-offset) ? span<element_type>{mData+offset, mData+extent} : span<element_type>{mData+offset, mData+offset+count}; } |