*/
explicit IndexSet (const size_type size);
+#ifdef DEAL_II_WITH_CXX11
+ /**
+ * Copy constructor.
+ */
+ IndexSet (const IndexSet &) = default;
+
+ /**
+ * Copy assignment operator.
+ */
+ IndexSet &operator= (const IndexSet &) = default;
+
+ /**
+ * Move constructor. Create a new IndexSet by transferring the internal data
+ * of the input set.
+ */
+ IndexSet (IndexSet &&is);
+
+ /**
+ * Move assignment operator. Transfer the internal data of the input set into
+ * the current one.
+ */
+ IndexSet &operator= (IndexSet &&is);
+#endif
#ifdef DEAL_II_WITH_TRILINOS
/**
+#ifdef DEAL_II_WITH_CXX11
+
+inline
+IndexSet::IndexSet (IndexSet &&is)
+ :
+ ranges (std::move(is.ranges)),
+ is_compressed (is.is_compressed),
+ index_space_size (is.index_space_size),
+ largest_range (is.largest_range)
+{
+ is.ranges.clear ();
+ is.is_compressed = true;
+ is.index_space_size = 0;
+ is.largest_range = numbers::invalid_unsigned_int;
+
+ compress ();
+}
+
+
+inline
+IndexSet &IndexSet::operator= (IndexSet &&is)
+{
+ ranges = std::move (is.ranges);
+ is_compressed = is.is_compressed;
+ index_space_size = is.index_space_size;
+ largest_range = is.largest_range;
+
+ is.ranges.clear ();
+ is.is_compressed = true;
+ is.index_space_size = 0;
+ is.largest_range = numbers::invalid_unsigned_int;
+
+ compress ();
+
+ return *this;
+}
+
+#endif
+
+
inline
void
IndexSet::clear ()
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2010 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// Check that the move constructor for `IndexSet` works properly
+
+#include "../tests.h"
+#include <fstream>
+
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/index_set.h>
+
+int main()
+{
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+
+ IndexSet is1(100);
+ is1.add_range(0, 10);
+ is1.add_range(30, 40);
+
+ deallog << is1.size() << ", " << is1.n_elements() << std::endl;
+
+ // Test that move construction works correctly and that the moved object is
+ // restored to the default state
+ IndexSet is2 = std::move(is1);
+
+ deallog << is2.size() << ", " << is2.n_elements() << std::endl;
+ deallog << is1.size() << ", " << is1.n_elements() << std::endl;
+
+ // Test that re-initializing the moved variable works
+ is1.set_size(200);
+ is1.add_range(90, 110);
+ is1.add_range(130, 140);
+ is1.add_range(145, 150);
+
+ deallog << is1.size() << ", " << is1.n_elements() << std::endl;
+
+ // Test that move assignment works correctly and that the moved object is
+ // restored to the default state
+ is2 = std::move(is1);
+ deallog << is2.size() << ", " << is2.n_elements() << std::endl;
+ deallog << is1.size() << ", " << is1.n_elements() << std::endl;
+}