Repository navigation
feat(reflection): add public rfl::type_name<T>() and rfl::type_name_v<T> - #236
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
This was referenced Dec 2, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
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.
Addresses munich-data-engineering/reflect-cpp#451 · Related munich-data-engineering/reflect-cpp#465
Problem
reflect-cpponly exposedrfl::type_name_t<T>(), which instantiatesrfl::Literaland allocates astd::stringvia.str().Callers needing a zero-allocation
constexprstd::string_viewtype name either reach intorfl::internal::or reimplement compiler-specific parsing.Summary
<rfl/type_name.hpp>withrfl::type_name<T>()andrfl::type_name_v<T>returning a zero-allocationconstexprstd::string_view.rfl::Literalinstantiation and builds on upstream PR #804.OSS consumers
NVIDIA/cuda-quantumTarget/Reflection.h#L27-L31rfl::internal::get_type_name_str_view<T>()with a workaround comment.munich-data-engineering/sqlgeninternal/get_type_name.hpp#L13-L44get_type_name_str_viewfor a publicstring_viewname.games-on-whales/wolfapi/api.cpp#L26rfl::type_name_t<T>().str()where a zero-allocationstring_viewsuffices.For Agents
upstream-queue(bcd8f9d8) · Score82/100(S=28,M=21,D=23,R=10) ·+28/-0(2f)#804)queue-tests/json/test_type_name.cpp