The question is pretty straight, how could I generate :
std::tuple<float, int, double>
If I know the type :
struct Foo { float a; int b; double c; };
And how could I retrieve the data, in both convertion?
You cannot do this in C++, as it would require a language feature known as reflection.
Instead, "manually" build the tuple or just begin with a tuple in the first place.
Alternatively, you could build a script in Python (or similar) to preprocess your code and auto-generate the resulting conversion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With