Adapt o3tl::span to P1872R0

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 7 December 2019 08:00 EST

..."span should have size_type, not index_type" (), as implemented by libc++ since "[libc++][P1872] span should have size_type, not index_type."

All uses of index_type had been added to mitigate the previous std::span change from signed (ptrdiff_t) to unsigned (size_t) index_type, see 6ef8420fdbf8dff16de13147c5ab833bc5e01121 "Adapt o3tl::span to updated C++2a std::span". There is no easy solution to transparently support all three std::span variants currently out there (signed index_type, unsigned index_type, unsigned size_type), without causing compilation failures due to CPPUNIT_ASSERT_EQUAL with arguments of different types, or compiler warnings about mixed signed/unsigned comparisons. So rule out the oldest std::span
variant (signed index_type) in configure.ac (so that o3tl::span will use its own hand-rolled code in that case) and simplify the uses of index_type to std::size_t (as had already been mentioned in 6ef8420fdbf8dff16de13147c5ab833bc5e01121).

Change-Id: I6ddf424ffb7941da3f69ad66fd29ecd35f09afae Reviewed-on: https://gerrit.libreoffice.org/84652

8e6865188242 Adapt o3tl::span to P1872R0
config_host/config_global.h.in | 3 +++
configure.ac | 16 ++++++++++++++++
include/o3tl/span.hxx | 14 ++++++++------
o3tl/qa/test-span.cxx | 7 ++++---
sfx2/source/control/dispatch.cxx | 3 ++-
5 files changed, 33 insertions(+), 10 deletions(-)

Upstream: cgit.freedesktop.org


  • Share