Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C capnproto
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 136
    • Issues 136
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 47
    • Merge requests 47
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Cap'n Proto
  • capnproto
  • Merge requests
  • !1624

Give deferred function guards the ability to run before destruction

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/bcaimano/bcaimano/deferred-run into master Feb 10, 2023
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: bcaimano

This commit adds three new functions to kj::_:Deferred:

  • A move-assignment operator to allow reuse of the same variable for deferred functors of the same type.
  • A run() function to immediately run the guard before destruction.
  • A nullptr assignment operator (nullification) as syntactic sugar for run().

It's worth mentioning that via the magic of kj::Maybe and universal references, Deferred maintains the ability to hold lvalue reference to functors instead of functor instances.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/bcaimano/bcaimano/deferred-run