ViaCognita
(ViaCognita)
January 17, 2025, 4:12pm
1
Hi!
This is part of Game Instance Subsystem class declaration:
TMap<int32, TSharedRef<FMyStruct>> GetMyData();
private:
TMap<int32, TSharedRef<FMyStruct>> MyData;
I want to allow read the variable MyData
, but without modifying it and without making any copy. How can I do it?
Maybe, this way:
const TMap<int32, TSharedRef<FMyStruct>>& GetMyData();
Or as an output parameter.
Thanks!
Yes, you would return a const& parameter. You would also mark your function as const so that clients with a const pointer could call it. so the full signature would be:
const TMap< >& GetMyData() const;
1 Like
system
(system)
Closed
February 16, 2025, 6:48pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.