Skip to content
Snippets Groups Projects

Change meaning of function template in TransformedRangeIterator

Merged Carsten Gräser requested to merge feature/flexible-transformedrange-iterator into master

So far the template parameter F was interpreted as function and a const F* was stored. With this patch F is directly interpreted as pointer_type and the * is added in the TransformedRangeView.

This allows to use other pointer-like types than const F*. E.g. TransformedRangeView now uses F* for a non-const iterator, such that the transformation calls a non-const operator() for non-const interators. Thus one can use TransformedRangeIterator to create self-contained mutable ranges on the fly, which was not possible before (either mutable with reference capture or self-contained but non-mutable).

A test for the new feature is added. This also contains a handy utility for combined mutable/nonmutable capture which is not directly possible with plain lambdas. Maybe we later want to make this public.

This patch potentially also allows to create self-contained TransformedRangeIterators by passing e.g. an optional (pointer-like but stores a value) as F. However, this should be carefully tested and - if working correctly - be accessible publicly in namespace Dune::.

Merge request reports

Merge request pipeline passed for c3fdf1da

Merged by Carsten GräserCarsten Gräser 9 months ago (Jun 15, 2024 4:20pm UTC)

Merge details

  • Changes merged into with ec6c61b1.
  • Deleted the source branch.

Pipeline waiting for manual action for ec6c61b1 on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading