Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
D
dorie
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 31
    • Issues 31
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • dorie
  • dorie
  • Issues
  • #188

Closed
Open
Opened Apr 27, 2020 by Lukas Riedel@lriedelOwner0 of 1 task completed0/1 task

Avoid dangling references in lambdas returned by parameterization interface

Overview

The following discussion from !187 (merged) should be addressed:

  • @sospinar started a discussion: (+1 comment)

    I have to accept that I never realized of this this on the parameterization interface. And now that I do, I do not like it at all. This lambda is getting passed through at least two classes with these references and is shouting "I will hold a dangling reference whenever you don't expect it". It is never advised to export lambdas with closures that hold references to other scopes (see CppCoreGuidelines or Effective Modern C++ ).

    Now is perhaps too late to complain and ask for a redesign as we have several of them, so I would be pleased with just a big warning to use these functions and those in the parameter classes: "only if you know what you are doing" or with very precise instructions how to avoid the dangling references.

Proposal

In the lambdas returned by Dorie::Parameterization::Richards and ::MualemVanGenuchten, capture the required parameters by value. Edit: Parameterizations in the Transport model are affected as well.

How to test the implementation?

Evaluate a parameterization function after destroying the parameterization interface which supplied it.

Related issues

Edited Apr 27, 2020 by Lukas Riedel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: dorie/dorie#188