From: Jean-Marc Lasgouttes Date: Tue, 18 Sep 2018 21:18:17 +0000 (+0200) Subject: Use std::move in InsetText::updateBuffer for notes and friends X-Git-Tag: lyx-2.4.0dev-acb2ca7b~3049 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=82516e356bc4b78b466c029bd34a3aeee298ebfa;p=features.git Use std::move in InsetText::updateBuffer for notes and friends Avoid as much as possible to do full copies of all counters, since that can be expensive. Unfortunately, it is only posible when we want to restore the saved counters. An earlier version (05d3a649) defined swap() for Counter, but caused problems on windows. Part of bug #5973. --- diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 74f60e422e..107753e8ab 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -814,13 +814,13 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype) // Note that we do not need to call: // tclass.counters().clearLastLayout() // since we are saving and restoring the existing counters, etc. - Counters const savecnt = tclass.counters(); + Counters savecnt = tclass.counters(); tclass.counters().reset(); // we need float information even in note insets (#9760) tclass.counters().current_float(savecnt.current_float()); tclass.counters().isSubfloat(savecnt.isSubfloat()); buffer().updateBuffer(it2, utype); - tclass.counters() = savecnt; + tclass.counters() = move(savecnt); } }