Skip to content

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Jan 18, 2026

Problem:

  • std::identity can cause dangling references.

Solution:

  • Add safe_identity which safely moves from an rvalue-reference argument.

Note:

Problem:
- `std::identity` can cause dangling references.

Solution:
- Add `safe_identity` which safely moves from an rvalue-reference argument.

Note:
- I have had similar use cases, and written similar functions before, but I
  think never quite as succinctly as elucidated by Dr Walter Brown in
  https://www.youtube.com/watch?v=sIZUg9tN4sk. Thanks, Walter!
@elbeno elbeno merged commit 5e5ffee into intel:main Jan 20, 2026
93 of 96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants