sol2 icon indicating copy to clipboard operation
sol2 copied to clipboard

Match overload based on usertype

Open gotschmarcel-ni opened this issue 3 years ago • 3 comments
trafficstars

I have two user types registered and I want to pass them to C++ and match an overload based on their type. Is that possible?

This is an example, but it doesn't work. Always goes to the first overload.

https://godbolt.org/z/8cW9ovWY7

gotschmarcel-ni avatar Feb 11 '22 13:02 gotschmarcel-ni

Ah, on the type.

You can't do that right now because I didn't write a checker for this. This just grabs the table that repesents the usertype, not specifically that usertype. I could probably add a discriminator for this case in particular.

ThePhD avatar Feb 11 '22 14:02 ThePhD

IF you're looking just for the value, that should work fine:

https://godbolt.org/z/vMnobvEzo

ThePhD avatar Feb 11 '22 14:02 ThePhD

Yeah the value works fine, but I'm actually interested in the user type itself. Would be nice if that would be possible.

gotschmarcel-ni avatar Feb 11 '22 14:02 gotschmarcel-ni