From 2e0b757e62536281f61b8d37987378646a246fcb Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Tue, 22 Dec 2020 18:59:43 +0100 Subject: Rename sorted_vector::erase(size_t) to erase_at emscripten clang fails with: sc/source/core/data/attarray.cxx:378:44: \ error: call to member function 'erase' is ambiguous aNewCondFormatData.erase(nIndex); ~~~~~~~~~~~~~~~~~~~^~~~~ include/o3tl/sorted_vector.hxx:86:15: note: candidate function size_type erase( const Value& x ) ^ include/o3tl/sorted_vector.hxx:97:10: note: candidate function void erase( size_t index ) This looks like a compiler error, but if the vector contained size_t values, this would also be ambiguous to begin with. So this just renames erase(size_t) to erase_at. And instead of a 2nd find in the failing code, after copying the vector, it mow uses std::distance to remove the item. Change-Id: I7d03ff32352a1890cc01ca241452c0f00d6a9302 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108212 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Jan-Marek Glogowski --- o3tl/qa/test-sorted_vector.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'o3tl') diff --git a/o3tl/qa/test-sorted_vector.cxx b/o3tl/qa/test-sorted_vector.cxx index 8b335040ee84..c7fdb0c0455d 100644 --- a/o3tl/qa/test-sorted_vector.cxx +++ b/o3tl/qa/test-sorted_vector.cxx @@ -98,7 +98,7 @@ public: CPPUNIT_ASSERT_EQUAL( static_cast(1), aVec.erase(p1) ); CPPUNIT_ASSERT_EQUAL( static_cast(2), aVec.size() ); - aVec.erase(1); + aVec.erase_at(1); CPPUNIT_ASSERT_EQUAL( static_cast(1), aVec.size() ); CPPUNIT_ASSERT_EQUAL( static_cast(0), aVec.erase(p4.get()) ); @@ -222,7 +222,7 @@ public: CPPUNIT_ASSERT_EQUAL( static_cast(1), aVec.erase(p1.get()) ); CPPUNIT_ASSERT_EQUAL( static_cast(2), aVec.size() ); - aVec.erase(1); + aVec.erase_at(1); CPPUNIT_ASSERT_EQUAL( static_cast(1), aVec.size() ); CPPUNIT_ASSERT_EQUAL( static_cast(0), aVec.erase(p4.get()) ); -- cgit