Let GridFactory::createGrid return ToUniquePtr
Until now, the method GridFactory::createGrid returned the grid object it created as a plain C pointer. That way, it was not obvious from the API who was to keep the responsibility for eventually deleting the object: the GridFactory or the calling code. At the 2017 Dune Dev Meeting in Heidelberg it was decided that the method should really return a std::unique_ptr instead, to make it clear that the calling code gets the ownership of the new object. To ease the transition towards the new interface, the class ToUniquePtr was introduced in dune-common. Objects of that type are std::unique_ptr objects, but they also cast to C pointers. That way, code that calls createGrid can still store the return value in a C pointer (but will trigger a deprecation warning). However, there does not seem to be a way to ensure similar compatibility for implementors of third-party grid implementations. Those will have to adapt their implementations of GridFactory::createGrid to the new return value.
Showing with 37 additions and 15 deletions