From b3b14171766089890b9e1b44935ed5dbc233c5f8 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 13 Dec 2022 22:03:02 +0300 Subject: Add noexcept to move constructors and move assignment operators --- libbuild2/prerequisite.hxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libbuild2/prerequisite.hxx') diff --git a/libbuild2/prerequisite.hxx b/libbuild2/prerequisite.hxx index 33efed0..2f63056 100644 --- a/libbuild2/prerequisite.hxx +++ b/libbuild2/prerequisite.hxx @@ -63,6 +63,8 @@ namespace build2 // Note that the lookup is often ad hoc (see bin.whole as an example). // But see also parser::lookup_variable() if adding something here. // + // @@ PERF: redo as vector so can make move constructor noexcept. + // public: variable_map vars; @@ -138,7 +140,10 @@ namespace build2 is_a (const target_type_type& tt) const {return type.is_a (tt);} public: - prerequisite (prerequisite&& x) + // Note that we have the noexcept specification even though vars + // (std::map) could potentially throw. + // + prerequisite (prerequisite&& x) noexcept : proj (move (x.proj)), type (x.type), dir (move (x.dir)), @@ -147,7 +152,8 @@ namespace build2 ext (move (x.ext)), scope (x.scope), target (x.target.load (memory_order_relaxed)), - vars (move (x.vars), *this, false /* shared */) {} + vars (move (x.vars), *this, false /* shared */) + {} prerequisite (const prerequisite& x, memory_order o = memory_order_consume) : proj (x.proj), -- cgit v1.1