Skip to content

Add public any_cast for type-erased memory resources#8269

Draft
bdice wants to merge 2 commits intoNVIDIA:mainfrom
bdice:add-public-any-cast-for-memory-resources
Draft

Add public any_cast for type-erased memory resources#8269
bdice wants to merge 2 commits intoNVIDIA:mainfrom
bdice:add-public-any-cast-for-memory-resources

Conversation

@bdice
Copy link
Copy Markdown
Contributor

@bdice bdice commented Apr 1, 2026

Description

closes #7994

Add cuda::mr::any_cast<Resource> overloads (mutable and const pointer variants) for all 4 type-erased memory resource wrappers: any_resource, any_synchronous_resource, resource_ref, and synchronous_resource_ref. This enables users to recover the concrete resource type from type-erased wrappers, analogous to std::any_cast for std::any.

Each overload is constrained with resource_with / synchronous_resource_with to ensure the cast target satisfies both the resource concept and all required properties, and delegates to the internal __any_cast on the __basic_any base class.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Add cuda::mr::any_cast<Resource> overloads for any_resource,
any_synchronous_resource, resource_ref, and synchronous_resource_ref
(mutable and const pointer variants, 8 overloads total).

This enables users to recover the concrete resource type from
type-erased wrappers, analogous to std::any_cast for std::any.

Closes NVIDIA#7994
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot bot commented Apr 1, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app bot moved this from Todo to In Progress in CCCL Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[FEA]: Cast any_resource to underlying type

1 participant