Skip to content
Discussion options

You must be logged in to vote

Hi! Thanks for the interest.

C++26 will add compile-time reflection. With this, we could iterate through the members of a struct in order to recursively generate a conversion trait. However, C++26 is not yet standardized and is also not yet supported by any major compilers.

So, in the future, I think we can automate this. Until then, the only way would be to use a DSL, which is probable macro-based. That's not something I'm interested in hacking together.

Conversion traits are super helpful for primitive types, but there is a performance risk of building your program around them for more complex types. There is also a codegen bloat concern for automating this process for every C++ type, s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by naomijub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants