Skip to content

Add support for passing rvalue to DataCollector to writers

Carsten Gräser requested to merge feature/datacollector-rvalue-support into master

This adds support for passing temporary DataCollectors to the writer constructors by:

  • Adding a constructor from DataCollector&& to the VtkWriterBase. This forwards the temporary to std::make_shared and thus takes ownership of the passed DataCollector.
  • Adding deduction guides for the writer implementations.

This allows to fully rely on type deduction and construct a writer with plain value semantics, e.g.

auto writer = UnstructuredGridWriter(LagrangeDataCollector(gridView, 2));

Disclaimer: I only tested the exact combination given in the example. The other ones are implemented the same way but have not been tested.

Merge request reports