Repository navigation
Add public rfl::type_name<T>() / type_name_v<T> and rfl::num_fields_v<T> - #127
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
… rfl::num_fields_v<T>
3 of 16 tasks
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.
Summary
Exposes a thin, self-contained public compile-time type-name header (
<rfl/type_name.hpp>) returning a null-terminatedstd::string_viewwithout instantiatingrfl::Literal, adds the standardrfl::num_fields_v<T>alias in<rfl/num_fields.hpp>, and fixes a latent dangling-temporary bug inrfl::internal::get_type_name_str_view<T>().include/rfl/type_name.hpp: Addsrfl::type_name_v<T>andconstexpr std::string_view rfl::type_name<T>() noexcept, backed by static-storageinline constexpr type_name_literal_v<T>(valid inconstexpr,static_assert, and runtime contexts in both C++20 and C++26 reflection modes, with no__PRETTY_FUNCTION__leak into.rodata).include/rfl/internal/get_type_name.hpp: Fixesget_type_name_str_view<T>()returning astd::string_viewinto a temporaryStringLiteralprvalue.include/rfl/num_fields.hpp: Addsrfl::num_fields_v<T>alias alongsiderfl::num_fields<T>.tests/json/test_type_name_and_num_fields.cpp.Real-World OSS Motivation
cudaq/lib/Target/Reflection.h(L26–31):cudaq/lib/Target/Yaml/v2/QuakeUnmappedProfileYaml.h(L74–77), they instantiated two fullrfl::named_tuple_t<...>::size()types just to compare field counts in astatic_assert.Verification
-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Werror): passed; 0 relative-include errors.tests/json/test_type_name_and_num_fields.cppunder-fsanitize=undefined -fno-sanitize-recover=all: passed.