Skip to content

Pass grid ownership with unique_ptr for clarity.

Max Kahnt requested to merge feature/grid-ownership-with-unique-ptr into master

Grid creation methods hand over the ownership.

The returned grids are no longer passed as pure pointers (Grid*) but with dynamic memory management features (std::unique_ptr<Grid>). Users of these methods might have to change their code to account for the following issues at least:

  • The return values cannot be cast to Grid* type. You should use get() for that or, better, take ownership with a std::unique_ptr<Grid>.
  • Explicit deletes conflict with the dynamic memory management (and can most likely just be scrapped in favor of the unique_ptr eventually going out of scope).

Note: The make***.hh-classes still exhibit several grid construction methods that cannot be used with arbitrary grid factories (because they call a constructor that is not required by the grid factory interface), despite lacking a proper reason for such a restriction.

Merge request reports