sw/source/core/unocore/unodraw.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
New commits: commit aa1398cc5c4453d1c7ca97eea0d536796de93bae Author: Julien Nabet <[email protected]> AuthorDate: Sat Nov 24 07:50:17 2018 +0100 Commit: Noel Grandin <[email protected]> CommitDate: Sat Nov 24 14:59:16 2018 +0100 Replace list by vector in unodraw.cxx (sw) Since m_aShapes is filled once during construction of SwXShapesEnumeration with n times call to insert_iterator (equivalent here to a push_front) then retrieving next element with begin() + pop_front we can simplify this by using a vector with: - n push_back during ctr - back() + pop_back in nextElement() Change-Id: I089c5fdfd59934b6cc1e392e9f0703b1ffaa234e Reviewed-on: https://gerrit.libreoffice.org/63928 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index e2d61dc8abe1..1235469996ec 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -390,8 +390,7 @@ namespace : public SwSimpleEnumeration_Base { private: - typedef std::list< css::uno::Any > shapescontainer_t; - shapescontainer_t m_aShapes; + std::vector< css::uno::Any > m_aShapes; protected: virtual ~SwXShapesEnumeration() override {}; public: @@ -412,12 +411,12 @@ SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage) : m_aShapes() { SolarMutexGuard aGuard; - std::insert_iterator<shapescontainer_t> pInserter = std::insert_iterator<shapescontainer_t>(m_aShapes, m_aShapes.begin()); sal_Int32 nCount = pDrawPage->getCount(); + m_aShapes.reserve(nCount); for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++) { uno::Reference<drawing::XShape> xShape(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY); - *pInserter++ = uno::makeAny(xShape); + m_aShapes.push_back(uno::makeAny(xShape)); } } @@ -432,8 +431,8 @@ uno::Any SwXShapesEnumeration::nextElement() SolarMutexGuard aGuard; if(m_aShapes.empty()) throw container::NoSuchElementException(); - uno::Any aResult = *m_aShapes.begin(); - m_aShapes.pop_front(); + uno::Any aResult = m_aShapes.back(); + m_aShapes.pop_back(); return aResult; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
