Remove inactive guards from the standard implementation of scope_guard

Open
#45 0 comments 0 reactions 1 assignee View on GitHub

@JeffGarland is already working on this.

Since Aug 17, 2025.

Assessment

This issue has not been assessed yet.

Description

After reading up on various implementations and studying design options I think that inactive guards should be removed from the design. This issue is to implement that change.

Inactive guards can occur as a resuilt of move construction or a call to release. The implications of these decisions are that the guard must store a boolean flag for the activation state and a check on destruction before calling the ExitFunction. The existence of these facilities also makes reasoning about code using scope more difficult since code readers must now process the entire scope to see of the guard has been released. Not that release is omitted by other implementations, notably GSL.

Dominant language
C++
Stars
12
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bemanproject/scope

All issues in bemanproject/scope

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.