How do I expose a USTRUCT by reference/pointer?
I have an object that's a proxy for an IDetailsView. It's a proxy because it needs to combine two objects from different modules, and let the user edit their properties. Fine.
In trying to make the structure less grody, I've been trying to simply add a reference to the USTRUCT on one side of the equation into the proxy as a property. That doesn't work.
To be clear:
I'm sure there's good reasons for that. But there's lots of good reasons to avoid passing large structs around by value. It also won't let me put it into a TSharedPtr. Using a C++ reference also is a problem since references don't make good members.
A solution would be to make it a UObject, but unfortunately that's not a good solution for me. I might just have to do it though, I really don't want to be copying data around.
So, here's the question again in brief:
Is there a way to expose a USTRUCT by reference in another UObject so that its properties may be edited directly?
If not, there really should be.
asked Mar 04 '15 at 03:40 AM in C++ Programming
No, you cannot do that, nor are there any plans to expose USTRUCT properties in that way. USTRUCTs are value types and are designed to be stored directly. If you want to share pointers to your data as properties, you need a UObject.
answered Mar 04 '15 at 12:57 PM
Steve Robb STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here