template <typename T2>
TableBase (const TableBase<N,T2> &src);
+#ifdef DEAL_II_WITH_CXX11
+ /**
+ * Move constructor. Transfers the contents of another Table.
+ *
+ * @note This constructor is only available if deal.II is built with C++11.
+ */
+ TableBase (TableBase<N,T> &&src);
+#endif
+
/**
* Destructor. Free allocated memory.
*/
template<typename T2>
TableBase<N,T> &operator = (const TableBase<N,T2> &src);
+#ifdef DEAL_II_WITH_CXX11
+ /**
+ * Move assignment operator. Transfer all elements of <tt>src</tt> into the
+ * table.
+ *
+ * @note This operator is only available if deal.II is built with C++11.
+ */
+ TableBase<N,T> &operator = (TableBase<N,T> &&src);
+#endif
+
/**
* Test for equality of two tables.
*/
+#ifdef DEAL_II_WITH_CXX11
+
+template <int N, typename T>
+TableBase<N,T>::TableBase (TableBase<N,T> &&src)
+ :
+ Subscriptor (std::move(src)),
+ values (std::move(src.values)),
+ table_size (src.table_size)
+{
+ src.table_size = TableIndices<N>();
+}
+
+#endif
+
+
+
template <int N, typename T>
template <class Archive>
inline
}
+
+#ifdef DEAL_II_WITH_CXX11
+
+template <int N, typename T>
+inline
+TableBase<N,T> &
+TableBase<N,T>::operator = (TableBase<N,T> &&m)
+{
+ static_cast<Subscriptor &>(*this) = std::move(m);
+ values = std::move(m.values);
+ table_size = m.table_size;
+ m.table_size = TableIndices<N>();
+
+ return *this;
+}
+
+#endif
+
+
+
template <int N, typename T>
inline
bool
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2012 - 2016 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.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include <iomanip>
+#include <fstream>
+
+#include <deal.II/base/table.h>
+
+int main()
+{
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.threshold_double(1.0e-10);
+
+ const unsigned int entries[] = {1, 2, 3, 4, 5, 6};
+ Table<2, unsigned int> t (2, 3);
+ t.fill (entries, true);
+
+ deallog << "Sizes: " << t.size(0) << ", " << t.size(1) << std::endl;
+ deallog << "Contents:" << std::endl;
+ for (unsigned int i = 0; i < t.size(0); ++i)
+ {
+ for (unsigned int j = 0; j < t.size(1); ++j)
+ deallog << t[i][j] << ' ';
+ deallog << std::endl;
+ }
+
+ Table<2, unsigned int> s = std::move(t);
+
+ deallog << "Sizes of moved-to table: "
+ << s.size(0) << ", " << s.size(1) << std::endl;
+ deallog << "Sizes of moved-from table: "
+ << t.size(0) << ", " << t.size(1) << std::endl;
+
+ deallog << "Contents of moved-to table:" << std::endl;
+ for (unsigned int i = 0; i < s.size(0); ++i)
+ {
+ for (unsigned int j = 0; j < s.size(1); ++j)
+ deallog << s[i][j] << ' ';
+ deallog << std::endl;
+ }
+
+ const TableIndices<2> new_size(4, 2);
+ s.reinit (new_size);
+ const unsigned int new_entries[] = {1, 2, 3, 4, 5, 6, 7, 8};
+ s.fill (new_entries, true);
+
+ deallog << "Sizes of new table: "
+ << s.size(0) << ", " << s.size(1) << std::endl;
+ deallog << "Contents of new table:" << std::endl;
+ for (unsigned int i = 0; i < s.size(0); ++i)
+ {
+ for (unsigned int j = 0; j < s.size(1); ++j)
+ deallog << s[i][j] << ' ';
+ deallog << std::endl;
+ }
+
+ t = std::move(s);
+
+ deallog << "Sizes of moved-to table: "
+ << t.size(0) << ", " << t.size(1) << std::endl;
+ deallog << "Sizes of moved-from table: "
+ << s.size(0) << ", " << s.size(1) << std::endl;
+
+ deallog << "Contents of moved-to table:" << std::endl;
+ for (unsigned int i = 0; i < t.size(0); ++i)
+ {
+ for (unsigned int j = 0; j < t.size(1); ++j)
+ deallog << t[i][j] << ' ';
+ deallog << std::endl;
+ }
+
+ return 0;
+}