I’m getting a warning in clang 7 about a value being copied when a move could be used to avoid a copy constructor call. I managed to get the code to compile using C style casting, but believe using the Move template provided would be ideal.
Current attempt at setting up the Move template properly:
TMoveSupportTraits<FStringOutputDevice> OutRef;
OutRef.Move = nullptr; // know this is incorrect
Move<FStringOutputDevice>(Out, OutRef.Move);
return OutRef;
I’ve been getting errors with every way I’ve tried fiddling with OutRef. At this time, OutRef.Move throws an error of .move being inaccessible by way of ..
How am I supposed to setup TMoveSupportTraits to properly use the Move constructor?
I’m guessing that function is returning a different type than FStringOutputDevice? As usually you don’t need to move a return value since the copy should be elided by RVO, but we have seen that warning in cases where a FStringOutputDevice is being returned as an FString.
Yeah, I’ll be switching to MoveTemp. I ended up getting it to compile on clang 7 before I had received your answer. I will be switching all of my changes to MoveTemp.