From 81f67977f543faca2dcc35846f73e2917375ae79 Mon Sep 17 00:00:00 2001 From: Martin Leitner-Ankerl Date: Sun, 26 Mar 2023 15:39:20 +0200 Subject: [PATCH] util: prevector's move ctor and move assignment is `noexcept` Move operations already are `noexcept`, so add the keyword to the methods. This makes the `PrevectorFillVectorIndirect...` benchmarks about twice as fast on my machine, because otherwise `std::vector` has to use a copy when the vector resizes. --- src/prevector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prevector.h b/src/prevector.h index f36cfe4ff6c..d3e4b8fd0d2 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -264,7 +264,7 @@ public: fill(item_ptr(0), other.begin(), other.end()); } - prevector(prevector&& other) { + prevector(prevector&& other) noexcept { swap(other); } @@ -276,7 +276,7 @@ public: return *this; } - prevector& operator=(prevector&& other) { + prevector& operator=(prevector&& other) noexcept { swap(other); return *this; }