Skip to content

Allow returning references in Std::visit()

Carsten Gräser requested to merge introduce-lfe-variant into master

Our own fallback implementation of Std::visit is currently not compatible with visitors returning lvalues. This is needed for the LocalFiniteElementVariant MR in dune-localfunctions. Notice that this also avoids an allocation that was used in Std::visit before.

For the record: A further cleanup could optimize Hybrid::switchCase to use a real c switch statement, because there's rumors that compiler can optimize this much better than an if ... else {} if... sequence (current implementation) or an array of fuction pointers (another possible visit implementation).

Merge request reports

Loading