diff options
author | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2021-03-04 23:29:50 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2021-03-05 11:51:32 +0100 |
commit | aecdb5425538130ff4b82d56fa910bffcd9c3b81 (patch) | |
tree | e9a51f36470b7df4f4c3ea1b5aa57f36e398c84c /sw | |
parent | d6886c340d1c940a4b3ab7e7ca499fff63183845 (diff) |
emplace_back: use perfect forwarding if possible
When using that new-ish method, try giving the compiler a chance to
construct in-place. Left out harder cases using initializer lists,
and might have missed slightly less obvious places.
Change-Id: Ifcc3a6d4599474457e37dd17a35c41fc73e7a17e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111980
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/attr/calbck.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfstringbuffer.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/swmodule.cxx | 58 | ||||
-rw-r--r-- | sw/source/uibase/uiview/uivwimp.cxx | 2 |
4 files changed, 33 insertions, 33 deletions
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index ae840edff48e..a37ee5bef376 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -268,7 +268,7 @@ sw::WriterMultiListener::~WriterMultiListener() void sw::WriterMultiListener::StartListening(SwModify* pDepend) { EndListening(nullptr); - m_vDepends.emplace_back(ListenerEntry(&m_rToTell, pDepend)); + m_vDepends.emplace_back(&m_rToTell, pDepend); } diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx b/sw/source/filter/ww8/rtfstringbuffer.cxx index 055ace53a429..f5d21d0b2bd4 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.cxx +++ b/sw/source/filter/ww8/rtfstringbuffer.cxx @@ -63,7 +63,7 @@ OString RtfStringBuffer::makeStringAndClear() OStringBuffer& RtfStringBuffer::getLastBuffer() { if (m_aValues.empty() || m_aValues.back().isGraphic()) - m_aValues.emplace_back(RtfStringBufferValue()); + m_aValues.emplace_back(); return m_aValues.back().getBuffer(); } @@ -73,7 +73,7 @@ void RtfStringBuffer::clear() { m_aValues.clear(); } void RtfStringBuffer::append(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode) { - m_aValues.emplace_back(RtfStringBufferValue(pFlyFrameFormat, pGrfNode)); + m_aValues.emplace_back(pFlyFrameFormat, pGrfNode); } void RtfStringBuffer::appendAndClear(RtfStringBuffer& rBuf) diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 9d5748ede637..d07ca6aa59aa 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -345,35 +345,35 @@ std::unique_ptr<SfxStyleFamilies> SwModule::CreateStyleFamilies() { std::unique_ptr<SfxStyleFamilies> pStyleFamilies(new SfxStyleFamilies); - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para, - SwResId(STR_PARAGRAPHSTYLEFAMILY), - BMP_STYLES_FAMILY_PARA, - RID_PARAGRAPHSTYLEFAMILY, GetResLocale())); - - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Char, - SwResId(STR_CHARACTERSTYLEFAMILY), - BMP_STYLES_FAMILY_CHAR, - RID_CHARACTERSTYLEFAMILY, GetResLocale())); - - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame, - SwResId(STR_FRAMESTYLEFAMILY), - BMP_STYLES_FAMILY_FRAME, - RID_FRAMESTYLEFAMILY, GetResLocale())); - - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page, - SwResId(STR_PAGESTYLEFAMILY), - BMP_STYLES_FAMILY_PAGE, - RID_PAGESTYLEFAMILY, GetResLocale())); - - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Pseudo, - SwResId(STR_LISTSTYLEFAMILY), - BMP_STYLES_FAMILY_LIST, - RID_LISTSTYLEFAMILY, GetResLocale())); - - pStyleFamilies->emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Table, - SwResId(STR_TABLESTYLEFAMILY), - BMP_STYLES_FAMILY_TABLE, - RID_TABLESTYLEFAMILY, GetResLocale())); + pStyleFamilies->emplace_back(SfxStyleFamily::Para, + SwResId(STR_PARAGRAPHSTYLEFAMILY), + BMP_STYLES_FAMILY_PARA, + RID_PARAGRAPHSTYLEFAMILY, GetResLocale()); + + pStyleFamilies->emplace_back(SfxStyleFamily::Char, + SwResId(STR_CHARACTERSTYLEFAMILY), + BMP_STYLES_FAMILY_CHAR, + RID_CHARACTERSTYLEFAMILY, GetResLocale()); + + pStyleFamilies->emplace_back(SfxStyleFamily::Frame, + SwResId(STR_FRAMESTYLEFAMILY), + BMP_STYLES_FAMILY_FRAME, + RID_FRAMESTYLEFAMILY, GetResLocale()); + + pStyleFamilies->emplace_back(SfxStyleFamily::Page, + SwResId(STR_PAGESTYLEFAMILY), + BMP_STYLES_FAMILY_PAGE, + RID_PAGESTYLEFAMILY, GetResLocale()); + + pStyleFamilies->emplace_back(SfxStyleFamily::Pseudo, + SwResId(STR_LISTSTYLEFAMILY), + BMP_STYLES_FAMILY_LIST, + RID_LISTSTYLEFAMILY, GetResLocale()); + + pStyleFamilies->emplace_back(SfxStyleFamily::Table, + SwResId(STR_TABLESTYLEFAMILY), + BMP_STYLES_FAMILY_TABLE, + RID_TABLESTYLEFAMILY, GetResLocale()); return pStyleFamilies; } diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index b607ccf9b256..336ce8de1975 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -230,7 +230,7 @@ void SwView_Impl::AddTransferable(SwTransferable& rTransferable) return !xTunnel.is(); }), mxTransferables.end()); - mxTransferables.emplace_back(uno::Reference<lang::XUnoTunnel>(&rTransferable)); + mxTransferables.emplace_back(&rTransferable); } osl_atomic_decrement(&rTransferable.m_refCount); } |