Commit 9c273f9c authored by Christian Engwer's avatar Christian Engwer

[!65] removed unnecessary constructors and use implicitly generated...

[!65] removed unnecessary constructors and use implicitly generated constructors instead in TreeContainer

Merge branch 'issue/treecontainer_constructors' into 'master'

ref:staging/dune-typetree\> This MR essentially applies the rule of zero to
the TreeContainerVectorBackend class and allows to copy this container.

See merge request [!65]

  [!65]: gitlab.dune-project.org/staging/dune-typetree/merge_requests/65
parents b6efcad8 b7806aa5
Pipeline #26099 passed with stage
in 1 minute and 46 seconds
......@@ -98,18 +98,16 @@ namespace Dune {
}
public:
//! Default constructor for the tree-container
TreeContainerVectorBackend() :
container_()
{}
//! Move the passed container into the internal storage
TreeContainerVectorBackend(Container&& container) :
container_(std::move(container))
{}
TreeContainerVectorBackend(TreeContainerVectorBackend&& other) :
container_(std::move(other.container_))
{}
template<class... T>
decltype(auto) operator[](const HybridTreePath<T...>& path) const
{
......
......@@ -47,6 +47,18 @@ Dune::TestSuite checkTreeContainer(const Tree& tree, const Value& value)
// default construct a container
Dune::TypeTree::UniformTreeContainer<Value,Tree> container2{};
// copy construct the container
auto container3{container};
// copy-assign the container
container3 = container;
// move-construct the container
auto container4{std::move(container2)};
// move-assign the container
container4 = std::move(container3);
Dune::TypeTree::forEachLeafNode(tree, [&] (auto&& node, auto treePath) {
test.check(notThrown([&]() {
container[treePath] = value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment