Comparing Two Void* Parameters (knowing their FProperty), How to do?


I have a UFunction that uses two void*. I use “CustomThunk” + “DECLARE_FUNCTION” to be able to handle the “Property” of the incoming variables and references.

My function is comparing whether they are equal or not. However, I would like to get the value of the void* to be able to compare, because at the moment it is checking whether they are exactly the same “variable” instead of checking whether the values of the variables are equal.
Note: I have access to the “FProperty” of each “void*”.

Some tip? Thank you in advance if someone replies.

Sincerely, HighRender.

FProperties & class introspection are specific to UE’s C++ framework. Void pointers are not. In order to introspect you’re gonna have to “come back to the fold” so to speak, coming back to the UE framework. In this case this means finding the UClass of each side of the comparison.

Which means, you need to determine which class is behind each void pointer. I’m 90% sure this is going to end badly since you have multiple candidate classes behind your void pointers.

It seems like you should really consider something other than void pointers. If you really want a void pointer somewhere, you could make a wrapper class/struct of some kind with two properties: A void pointer, and some indication of the class behind the void pointer, that enables you to cast safely.

But in my opinion, since you’re expecting a match in the properties of each object, something akin to an interface or a common abstract parent class would do the trick. Since I don’t believe that UE5’s interfaces officially support properties, maybe a common abstract parent class?

If that’s not possible, then use a UE5 interface. It won’t let you make UPROPERTIES so any property will be unknown to the reflection system, but at the same time, if you cast to the interface class, you don’t need to use UE’s introspection anymore.

Thank you for the reply.

I’ll do some research later on Interfaces. By the way, are interfaces allowed in “Blueprint Function Library” (c++)? (Forgive me if it’s a silly question, lol)

The class of both “void*” are exactly the same. I was thinking about creating a function that would be able to tell if the value of two variables are equal. Like, everything worked except this detail about figuring out how to use “void*” to get its class and do the checking.
Example: Knowing if two integers have the same value. I know you might think that this already exists in blueprints, yes it does, however, “not in a universal way”. Some types of variables do not work in the engine’s “EqualEqual” function (for blueprints).

If you had any ideas on how to adjust this last detail, giving an example, I would be very grateful. If not, perhaps in the distant future. This function would be the best of all. I would be able to make variations of it, which everyone would like. However, at the moment I ended up putting the idea aside and moving on to plan b. Of course, hope always remains, I will wait.

Sincerely, HighRender.