Skip to content

WIP: move cleaned-up dune-typetree to dune-common

Simon Praetorius requested to merge feature/common_typetree into master

This is a work-in-progress MR for the inclusion of dune-type into dune-common as decided on the dune developer meeting 2020. It acts as a base of discussion and may be split up into smaller parts if necessary. Some points might be discussed and reverted to previous implementation.

Major changes/cleanup compared to dune-typetree:

  1. Unification of implementation namespaces to Impl::
  2. Replace Hybrid::ifElse with if constexpr
  3. Cleanup of recursive implementation of child() and childStorage
  4. several unused utilities are removed
  5. TreeInfo moved to file treeinfo.hh
  6. convert_arg utility move to shared_ptr.hh and renamed to copy_or_wrap
  7. fully static treepath TreePath removed
  8. unification of the code style

More cleanup suggestions:

  • Remove one of the Child types: type or Type. They refer to the same underlying type.
  • In PowerNode, CompositeNode, and ProxyNode, we use three types of constructors and setChild methods, one for l-value references, one for r-values references and one for shared_ptr. All store the child in a shared_ptr. Maybe one should introduce a corresponding utility function in shared_ptr.hh, let's call it copy_or_wrap_or_share that copies into new shared_ptr on const l-value references, wraps into a non-destroying shared_ptr in case or l-value references, forwards a shared_ptr and moves into a new shared_ptr for r-value references. (the semantic is slightly different to wrap_or_share_or_move that wraps for const and mutable l-value references)
Edited by Simon Praetorius

Merge request reports

Loading