Skip to content

[WIP] add a new class Dune::nocopy_ptr

Christian Engwer requested to merge feature/copy_ptr into master

this new class behaves somewhat similar to a unique_ptr, in the sense that it guarantees single ownership. In addition it offers a well defined way to clone/duplicate the object inside the unique_ptr. Internally it uses type-erasure for deleter and creator, which is in particular necessary if the pointer is only a pointer to an abstract base class.

there are currently a few open points

  • implement and test ptr.release(...)
  • implement and test make_copy_ptr<Interface,Impl>(args...)
  • decide on a name. Perhaps nocopy_ptr isn't the best choice...

As discussed on the dev-meeting, we intend to use this class internally in dune-istl to manage life-time and ownership of pointer like objects, as a replacement for references, which are currently used.

Edited by Christian Engwer

Merge request reports