Skip to main content

New answers tagged

5 votes
Accepted

Using C++26 reflection to design a concept to check, by name, if a class has a given member function

^^Sig doesn't give you the meta::info of the original function type out(in...), but rather its type alias. You can directly extract the info of the function type out(in...) with: if (std::meta::...
康桓瑋's user avatar
  • 47.4k
12 votes
Accepted

Mirroring C++ Lambda Captures into a POD struct via C++26 Reflection (P2996)

This behavior is currently implementation-defined. Per [meta.reflection.member.queries], nonstatic_data_members_of(r, ctx) (where r is the reflection of a class or namespace Q) returns reflections of ...
cpplearner's user avatar
  • 20.6k
0 votes

How to add a string literal annotation to items?

Another option that does not require consteval is to template the size of the string literal: struct Label { const char* msg; }; template <size_t N> constexpr Label label(const char (&...
dsch775's user avatar
2 votes

Is there a way to get a ref struct property using reflection?

This may not meet your use case, but I suspect it will. Rather than returning the value, you can stick within the spirit of the ref struct rules by consuming the value without it leaving the stack. ...
Jon Skeet's user avatar
  • 1.5m
1 vote

Is there a way to get a ref struct property using reflection?

I don't think there is a (easy and flexible) way of accessing a ref struct property (in this reflection-like manner) without knowing the return type at compile time, via a type parameter. Honestly, ...
7Swaize's user avatar
  • 67
2 votes
Accepted

Unable to call private method for System.Security.Cryptography.X509Certificates.SubjectAlternativeNameBuilder

The first bug I can see is: the method you are looking for AddGeneralName does not exist, or it is non-public. But you are looking for this method as it was public, because the default for System.Type....
Sergey A Kryukov's user avatar

Top 50 recent answers are included