summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-02-22 17:29:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-03-19 09:43:45 +0100
commit6229fc671b90ccceaf01067c92f08127f72d0f42 (patch)
tree5f65da3f43d5d03bed793ae929d26c8f43076dbd
parent29ccc5f041562305c559d0e84ed90af9ccf302f7 (diff)
Adapt o3tl::span to removal of std::span::cbegin et al
<https://cplusplus.github.io/LWG/issue3320> "span::cbegin/cend methods produce different results than std::[ranges::]cbegin/cend", as implemented now in <https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=commit; h=247f410b83797a1840573840cc2a539ef9d7f96b> "libstdc++: Remove std::span::cbegin and std::span::cend (LWG 3320)". Turns out we only used the removed member functions in o3tl/qa/test-span.cxx. Change-Id: I6c73797594b4e0e753a88840033d54961e271df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89261 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 6fbfad6b00e8c35346ee59cd32a0d7ccc0d8c19c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90634 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/o3tl/span.hxx7
-rw-r--r--o3tl/qa/test-span.cxx6
2 files changed, 0 insertions, 13 deletions
diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx
index b19d2d847ac7..8af8ba846b65 100644
--- a/include/o3tl/span.hxx
+++ b/include/o3tl/span.hxx
@@ -62,18 +62,11 @@ public:
constexpr iterator begin() const noexcept { return data_; }
constexpr iterator end() const noexcept { return begin() + size(); }
- constexpr const_iterator cbegin() const noexcept { return begin(); }
- constexpr const_iterator cend() const noexcept { return end(); }
-
reverse_iterator rbegin() const noexcept
{ return reverse_iterator(end()); }
reverse_iterator rend() const noexcept
{ return reverse_iterator(begin()); }
- constexpr const_reverse_iterator crbegin() const noexcept
- { return rbegin(); }
- constexpr const_reverse_iterator crend() const noexcept { return rend(); }
-
constexpr size_type size() const noexcept { return size_; }
constexpr reference operator [](size_type pos) const {
diff --git a/o3tl/qa/test-span.cxx b/o3tl/qa/test-span.cxx
index 3cb78ace1db2..26eedfc21938 100644
--- a/o3tl/qa/test-span.cxx
+++ b/o3tl/qa/test-span.cxx
@@ -34,15 +34,9 @@ private:
CPPUNIT_ASSERT_EQUAL(1, *v.begin());
CPPUNIT_ASSERT_EQUAL(
o3tl::span<int>::difference_type(3), v.end() - v.begin());
- CPPUNIT_ASSERT_EQUAL(1, *v.cbegin());
- CPPUNIT_ASSERT_EQUAL(
- o3tl::span<int>::difference_type(3), v.cend() - v.cbegin());
CPPUNIT_ASSERT_EQUAL(3, *v.rbegin());
CPPUNIT_ASSERT_EQUAL(
o3tl::span<int>::difference_type(3), v.rend() - v.rbegin());
- CPPUNIT_ASSERT_EQUAL(3, *v.crbegin());
- CPPUNIT_ASSERT_EQUAL(
- o3tl::span<int>::difference_type(3), v.crend() - v.crbegin());
CPPUNIT_ASSERT_EQUAL(std::size_t(3), v.size());
CPPUNIT_ASSERT(!v.empty());
CPPUNIT_ASSERT_EQUAL(2, v[1]);