From 424fcd3901925882e0bc1922805f24c052b418b3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Dec 2022 11:55:42 +0300 Subject: Add noexcept to move constructors and move assignment operators --- libbpkg/manifest.cxx | 15 ++++++++------- libbpkg/manifest.hxx | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 03aef34..57684df 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -566,7 +566,7 @@ namespace bpkg } version& version:: - operator= (version&& v) + operator= (version&& v) noexcept { if (this != &v) { @@ -624,7 +624,8 @@ namespace bpkg } text_file:: - text_file (text_file&& f): file (f.file), comment (move (f.comment)) + text_file (text_file&& f) noexcept + : file (f.file), comment (move (f.comment)) { if (file) new (&path) path_type (move (f.path)); @@ -642,12 +643,12 @@ namespace bpkg } text_file& text_file:: - operator= (text_file&& f) + operator= (text_file&& f) noexcept { if (this != &f) { this->~text_file (); - new (this) text_file (move (f)); // Assume noexcept move-construction. + new (this) text_file (move (f)); // Rely on noexcept move-construction. } return *this; } @@ -2643,7 +2644,7 @@ namespace bpkg } build_class_term:: - build_class_term (build_class_term&& t) + build_class_term (build_class_term&& t) noexcept : operation (t.operation), inverted (t.inverted), simple (t.simple) @@ -2667,13 +2668,13 @@ namespace bpkg } build_class_term& build_class_term:: - operator= (build_class_term&& t) + operator= (build_class_term&& t) noexcept { if (this != &t) { this->~build_class_term (); - // Assume noexcept move-construction. + // Rely on noexcept move-construction. // new (this) build_class_term (move (t)); } diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 35bf915..0fd5feb 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -102,7 +102,7 @@ namespace bpkg version (version&&) = default; version (const version&) = default; - version& operator= (version&&); + version& operator= (version&&) noexcept; version& operator= (const version&); // If the revision is ignored, then the iteration (that semantically @@ -281,9 +281,9 @@ namespace bpkg text_file (path_type p, std::string c) : file (true), path (std::move (p)), comment (std::move (c)) {} - text_file (text_file&&); + text_file (text_file&&) noexcept; text_file (const text_file&); - text_file& operator= (text_file&&); + text_file& operator= (text_file&&) noexcept; text_file& operator= (const text_file&); ~text_file (); @@ -882,9 +882,9 @@ namespace bpkg build_class_term () : operation ('\0'), inverted (false), simple (true), name () {} - build_class_term (build_class_term&&); + build_class_term (build_class_term&&) noexcept; build_class_term (const build_class_term&); - build_class_term& operator= (build_class_term&&); + build_class_term& operator= (build_class_term&&) noexcept; build_class_term& operator= (const build_class_term&); ~build_class_term (); -- cgit v1.1