Skip to content

[wip] Use reference qualifiers to avoid reference to temporaries

Carsten Gräser requested to merge feature/use-ref-qualifiers into master

Until now one could write code like

auto&& jt = AffineGeometry<...>(...).jacobianTransposed(...);

This compiles and (depending on the surrounding code) may even lead to the expected results. However, since AffineGeometry hands out a reference to the stored matrix jt is a reference to a temporary that may be overwritten by other stack variables.

By explicitly deleting the overload for r-values the compiler rejects the above code and only allows to call jacobianTransposed() on l-values.

Merge request reports

Loading