include/o3tl/span.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit 6ef8420fdbf8dff16de13147c5ab833bc5e01121 Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Mar 18 16:26:04 2019 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Mon Mar 18 19:18:17 2019 +0100 Adapt o3tl::span to updated C++2a std::span ...where index_type has changed from ptrdiff_t to size_t, see <https:// github.com/cplusplus/draft/commit/7f2493e2e2d34b42a6c12c8806e536d4feb3aee3> "P1227R2 Signed ssize() functions, unsigned size() functions". Ideally, ece27693ba52417bc4b68045f5544a5cc43299dc "Adapt to C++2a std::span<>::index_type being unsigned size_t" could be simplified now to use std::size_t, but there may be build environments that include a C++2a <span> that hasn't been adapted to P1227R2 yet. Change-Id: I7bfc0da65d415ef06e94d95b5f62030aeb8b35f6 Reviewed-on: https://gerrit.libreoffice.org/69391 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx index acb31bab728d..1618b86df897 100644 --- a/include/o3tl/span.hxx +++ b/include/o3tl/span.hxx @@ -40,7 +40,7 @@ public: using iterator = pointer; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using reverse_iterator = std::reverse_iterator<iterator>; - using index_type = std::ptrdiff_t; + using index_type = std::size_t; using difference_type = std::ptrdiff_t; constexpr span() noexcept : data_(nullptr), size_(0) {} @@ -52,7 +52,7 @@ public: : data_(a), size_(len) { // not terribly sure about this, might need to strengthen it - assert((a == nullptr && len == 0) || (a != nullptr && len >= 0)); + assert(a != nullptr || len == 0); } constexpr bool empty() const noexcept { return size_ == 0; } @@ -75,7 +75,7 @@ public: constexpr index_type size() const noexcept { return size_; } constexpr reference operator [](index_type pos) const { - assert(0 <= pos && pos < size()); + assert(pos < size()); return data_[pos]; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
