const overloads & nodiscard for LockedPtr members#377
Open
sankurm wants to merge 1 commit into
Open
Conversation
sankurm
requested review from
4og,
antonkri,
arkjedrz and
pawelrutkaq
as code owners
July 14, 2026 11:59
sankurm
requested a deployment
to
workflow-approval
July 14, 2026 11:59 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
July 14, 2026 11:59 — with
GitHub Actions
Waiting
sankurm
force-pushed
the
locked_ptr_const_nodiscard_fns
branch
from
July 14, 2026 12:00
0fea656 to
b16531d
Compare
sankurm
temporarily deployed
to
workflow-approval
July 14, 2026 12:00 — with
GitHub Actions
Inactive
sankurm
temporarily deployed
to
workflow-approval
July 14, 2026 12:00 — with
GitHub Actions
Inactive
|
The created documentation from the pull request is available at: docu-html |
sankurm
force-pushed
the
locked_ptr_const_nodiscard_fns
branch
from
July 15, 2026 12:53
b16531d to
86b1194
Compare
sankurm
temporarily deployed
to
workflow-approval
July 15, 2026 12:53 — with
GitHub Actions
Inactive
sankurm
temporarily deployed
to
workflow-approval
July 15, 2026 12:53 — with
GitHub Actions
Inactive
There was a problem hiding this comment.
Pull request overview
This PR updates score::concurrency::LockedPtr to better support const-correct access patterns and to encourage correct usage via [[nodiscard]], in preparation for upcoming “monadic interface” work.
Changes:
- Added
[[nodiscard]]tooperator*()/operator->()and introduced missingconstoverloads for both. - Split
get()into const/non-const overloads and made the const overload returnconst T*. - Added a
constoverload ofunlock_guard()and made the stored lockmutableto support that overload.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
score/concurrency/locked_ptr.h |
Adds [[nodiscard]] and const overloads for pointer-like accessors; enables unlock_guard() on const instances via mutable lock storage. |
score/concurrency/locked_ptr_test.cpp |
Reworks/extends tests to cover the new const overloads and [[nodiscard]]-motivated API changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+162
to
+166
| { | ||
| auto cug_mut = std::as_const(lp_mut).unlock_guard(); | ||
| EXPECT_TRUE((std::is_same_v<decltype(cug_mut), UnlockGuard<std::unique_lock<std::mutex>>>)) | ||
| << "unlock_guard() should return UnlockGuard<std::unique_lock<std::mutex>>"; | ||
| } |
fbaeuerle
reviewed
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This prepares the
LockedPtrfor the monadic interface that it should have. The support functions[[nodiscard]]constoverloads are supported (needed for further upcoming functionality)