From b8a792248a2781062cdeb60c14a30a1f744d83e8 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 31 Oct 2014 11:47:03 +0100 Subject: [PATCH] tgbasafracomplement: avoid some std::set copies * src/tgba/tgbasafracomplement.cc: Here. Beside being more efficient, the use of std::swap instead of an assignment also protects us from a bug recently introduced in the development version of G++. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63698 --- src/tgba/tgbasafracomplement.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tgba/tgbasafracomplement.cc b/src/tgba/tgbasafracomplement.cc index 258f21ee7..b0838fb95 100644 --- a/src/tgba/tgbasafracomplement.cc +++ b/src/tgba/tgbasafracomplement.cc @@ -147,11 +147,9 @@ namespace spot /// \brief Copy the tree \a other, and set \c marked to false. safra_tree::safra_tree(const safra_tree& other) - : marked(false) + : marked(false), name(other.name), nodes(other.nodes) { - name = other.name; parent = 0; - nodes = other.nodes; for (auto i: other.children) { safra_tree* c = new safra_tree(*i); @@ -365,7 +363,7 @@ namespace spot } } } - nodes = new_subset; + std::swap(nodes, new_subset); for (auto c: children) c->succ_create(condition, cache_transition);