r/cpp • u/petrdan • Sep 15 '26
From Templates to Reflection, Part 1: Back to the Basics with type_vector
https://daniel-petrovic.github.io/blog/type-vector-operating-on-types/
39
Upvotes
r/cpp • u/petrdan • Sep 15 '26
7
u/NewLlama Sep 15 '26
I use this technique a lot in my code. It's really powerful but ADL tries to instantiate nested classes on unqualified calls when the type holder is an argument. So if you try to implement something like `operator+` you run into problems with forward-declared or otherwise uninstantiable types. There's a workaround but it's messy.
4
u/zerhud Sep 15 '26
Why don’t use plain functions (as the boost.hana) instead of struct with templates?