From b065496b23f249d9c08a6267d2aaa2fd1c81e56a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 17 Feb 2024 16:41:41 +0600 Subject: Remove more unneeded const_cast Change-Id: If62cf2011ae63501cdf5e87a6ee7402aa74b2b3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163525 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/inc/docary.hxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sw/inc/docary.hxx') diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index dce6a44b7576..5cd132f0ef44 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -131,7 +131,7 @@ public: erase( begin() + aStartIdx, begin() + aEndIdx); } - size_t GetPos(Value const& p) const + size_t GetPos(typename std::remove_pointer_t const* const p) const { const_iterator const it = std::find(begin(), end(), p); return it == end() ? SIZE_MAX : it - begin(); @@ -159,9 +159,6 @@ public: virtual Value GetFormat(size_t idx) const override { return SwVectorModifyBase::operator[](idx); } - size_t GetPos(const SwFormat *p) const - { return SwVectorModifyBase::GetPos( static_cast( const_cast( p ) ) ); } - // Override return type to reduce casting virtual Value FindFormatByName(const OUString& rName) const override { return static_cast(SwFormatsBase::FindFormatByName(rName)); } @@ -230,7 +227,7 @@ private: mutable sal_uInt32 m_nMaxMovedID = 1; //every move-redline pair get a unique ID, so they can find each other. public: ~SwRedlineTable(); - bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast(p)) != maVector.end(); } + bool Contains(const SwRangeRedline* p) const { return maVector.find(p) != maVector.end(); } size_type GetPos(const SwRangeRedline* p) const; bool Insert(SwRangeRedline*& p); -- cgit