Skip to main content
Filter by
Sorted by
Tagged with
8 votes
1 answer
848 views

With C++26 reflection, we can simply iterate all data members of an object: #include <iostream> #include <meta> struct Foo { int x; int y; }; void PrintFoo(const Foo& foo) { ...
Timothy Liu's user avatar
2 votes
2 answers
419 views

I would like to write something like: template <typename E, E fallback> E safe_cast_to_enum(std::underlying_type_t<E> e); which, for an enum class (or just an enum?) E, casts e to a ...
einpoklum's user avatar
  • 137k
6 votes
2 answers
272 views

I am working on a project that makes heavy use of static polymorphism. A particular use-case that I am interested in would be made possible by static reflection, but we still don't have this in C++. ...
wvn's user avatar
  • 675
1 vote
0 answers
2k views

I have trait like this to describe the structure of a type, if I know the type at compile-time, of course I can inspect all the associate constants, associate types, and static member functions of it. ...
炸鱼薯条德里克's user avatar
3 votes
2 answers
290 views

This is Oliver Hanappi's static reflection code he posted on stackoverflow private static string GetMemberName(Expression expression) { switch (expression.NodeType) { ...
Maslow's user avatar
  • 18.8k
2 votes
3 answers
892 views

I've been studying up on static reflection with LINQ expressions - very cool! One thought I had - is it possible for one class to 'generate' fields on one class based on static reflection done on ...
n8wrl's user avatar
  • 19.9k