From 27453810978427081672c85b6706d2f22cb1ce3a 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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/tgba/tgbasafracomplement.cc b/src/tgba/tgbasafracomplement.cc index d2eb770b2..66b0ad632 100644 --- a/src/tgba/tgbasafracomplement.cc +++ b/src/tgba/tgbasafracomplement.cc @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche -// et Développement de l'Epita (LRDE). +// Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de +// Recherche et Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -149,11 +149,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 (child_list::const_iterator i = other.children.begin(); i != other.children.end(); ++i) { @@ -376,7 +374,7 @@ namespace spot } } } - nodes = new_subset; + std::swap(nodes, new_subset); for (child_list::iterator i = children.begin(); i != children.end(); ++i) (*i)->succ_create(condition, cache_transition);