LockedPtr::and_then introduced - #458
Open
sankurm wants to merge 3 commits into
Open
Conversation
sankurm
requested review from
4og,
antonkri,
arkjedrz,
fbaeuerle and
pawelrutkaq
as code owners
August 11, 2026 12:04
sankurm
temporarily deployed
to
workflow-approval
August 11, 2026 12:04 — with
GitHub Actions
Inactive
sankurm
temporarily deployed
to
workflow-approval
August 11, 2026 12:04 — with
GitHub Actions
Inactive
Contributor
|
The created documentation from the pull request is available at: docu-html |
There was a problem hiding this comment.
Pull request overview
Adds LockedPtr::and_then for optional-based monadic chaining.
Changes:
- Adds optional detection support.
- Implements four value-category overloads.
- Adds tests for success, empty, and null cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
score/concurrency/type_traits.h |
Adds optional type detection. |
score/concurrency/locked_ptr.h |
Implements and_then. |
score/concurrency/locked_ptr_test.cpp |
Tests the new overloads. |
Suppressed comments (6)
score/concurrency/locked_ptr.h:227
Retpreserves cv/reference qualifiers, so this overload rejects callables returningconst optional<T>oroptional<T>&, unlikescore::cpp::optional::and_then. Decay the invocation result so all supported optional return forms produce an optional value.
typename Ret = std::invoke_result_t<Func, const LockedPtr&>,
score/concurrency/locked_ptr.h:248
Retpreserves cv/reference qualifiers, so this overload rejects callables returningconst optional<T>oroptional<T>&, unlikescore::cpp::optional::and_then. Decay the invocation result so all supported optional return forms produce an optional value.
typename Ret = std::invoke_result_t<Func, LockedPtr>,
score/concurrency/locked_ptr.h:269
Retpreserves cv/reference qualifiers, so this overload rejects callables returningconst optional<T>oroptional<T>&, unlikescore::cpp::optional::and_then. Decay the invocation result so all supported optional return forms produce an optional value.
typename Ret = std::invoke_result_t<Func, const LockedPtr&>,
score/concurrency/locked_ptr_test.cpp:53
- This namespace-scope lambda object is a mutable global. Repository style requires fixed namespace-scope values to be
const/constexprandk-prefixed (docs/cpp-style-guide.md:29); use a constant or named helper function and update its call sites.
auto value_if_positive = [](LPtr2IntW& lp) -> score::cpp::optional<int> {
score/concurrency/locked_ptr_test.cpp:61
- This namespace-scope lambda object is a mutable global. Repository style requires fixed namespace-scope values to be
const/constexprandk-prefixed (docs/cpp-style-guide.md:29); use a constant or named helper function and update its call sites.
auto cvalue_if_positive = [](const LPtr2IntW& lp) -> score::cpp::optional<int> {
score/concurrency/locked_ptr_test.cpp:69
- This namespace-scope lambda object is a mutable global. Repository style requires fixed namespace-scope values to be
const/constexprandk-prefixed (docs/cpp-style-guide.md:29); use a constant or named helper function and update its call sites.
auto opt_move_get = [](LPtr2IntW lp) -> score::cpp::optional<IntWrapper*> {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sankurm
requested a deployment
to
workflow-approval
August 13, 2026 14:17 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 13, 2026 14:17 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 13, 2026 14:17 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 13, 2026 14:17 — with
GitHub Actions
Waiting
sankurm
force-pushed
the
locked_ptr_monadic_and_then
branch
from
August 13, 2026 14:23
5a7302d to
1586ba2
Compare
Contributor
|
Documentation preview for this pull request is available at: |
sankurm
requested a deployment
to
workflow-approval
August 17, 2026 09:45 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 17, 2026 09:45 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 17, 2026 09:45 — with
GitHub Actions
Waiting
sankurm
requested a deployment
to
workflow-approval
August 17, 2026 09:45 — with
GitHub Actions
Waiting
sankurm
force-pushed
the
locked_ptr_monadic_and_then
branch
from
August 17, 2026 10:38
e62e468 to
c615da8
Compare
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.
Monadic interfaces help write functional code by supporting
transform,and_thenandor_else. This PR is to supportand_then.This makes the following possible.