Skip to main content
3 votes
1 answer
141 views

Background info: I am trying to write a source code (i.e., plain text) generation tool which generates a stub implementation of an abstract base class. This looks something like namespace acme { ...
Lia Stratopoulos's user avatar
11 votes
1 answer
1k 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
1 vote
1 answer
477 views

This is a bit of a "moon shot", but still: does the C++ Protobuf implementation support "static reflection"; or is there a way to make this work? My goal is to have an API e.g. ...
oliver's user avatar
  • 6,928
2 votes
2 answers
462 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
  • 139k
12 votes
1 answer
8k views

As far as I know, static reflection is currently on the roadmap for C++26. The reflection TS proposes a type-based syntax, but a value-based syntax has also been proposed in the meantime. In P2560 ...
Benjamin Buch's user avatar
6 votes
2 answers
281 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
4 votes
1 answer
495 views

So I have been quite looking forward to metaclasses. I then heard that it won't be in c++23, as they think we first need reflection and reification in the language before we should add metaclasses. ...
Yakk - Adam Nevraumont's user avatar
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
1 vote
1 answer
212 views

I need binding between two similar objects (C#): public class TypeA { public int I; public string S; } public class TypeB { public IntField I; public StringField S; } When a ...
Tom's user avatar
  • 1,052
3 votes
2 answers
292 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.9k
6 votes
1 answer
161 views

Take the standard return statement for a controller: return View("Index"); is there a way to make this thing compile time safe? using static reflection or some other trick?
Maslow's user avatar
  • 18.9k
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