Closed Yaraslaut closed 1 month ago
Hey, @Yaraslaut !
This will be more clear once we've updated the P2996 draft, but the behavior of identifier_of
is correct: The function only succeeds when the reflected construct has a name that is an identifier. Since an identifier is a sequence of once or more characters, identifier_of(^decltype([] {}))
will fail to be a constant expression since the closure type has no name.
display_string_of
, however, should definitely render a string; I've fixed this in 616aa8e. When the change hits godbolt tomorrow, the line
std::println("{}", display_string_of(created_type));
will print:
CreateUniqueT<int, (anonymous type)>
Thanks a lot for the bug report, and thanks for trying out the bleeding edge changes!
thanks for the fast fix @katzdm I checked, everything is working
In some cases
display_string_of
oridentifier_of
can not be evaluated, for example: https://godbolt.org/z/KWff1ezx3It would be great to have it available for weird entities like one present above