Since you’ve essentially asked me the same question three times, I’m guessing you’re a little confused about how strings work in C?
String literals aren’t magic, they’re just a variable of type const char[]. If you want fancy behaviour from them, you’ll need to convert them to some sort of string class, like FString.
Overloading a global operator for two intrinsic types (const char[] and double) is getting into really suspect behaviour which may come back to bite you later on. Are you sure you want to be doing this?
I am making a log function in which I write strings, numbers, boolean and everything I want to log (see updated question text) and coming from a flash background, using the + sign turns everything to string and concatenates it. Not in C++ apparently so I am trying to overload the + to accept pretty much any such combinations. Keeping it all as FString because why not. Am rather new at C++ and this pointer business is indeed confusing.
Just to make sure, but you do know that UE4 has logging support built in via UE_LOG?
Our more typical way to create a string like you’re doing in your question would be to use FString::Printf (which uses printf style formatting syntax) rather than overload operators (particularly the + operator since it produces a lot of copies).
I do know about the logs but they are drowned in a flood of other system messages. and showing messages in the editor is not efficient. The simplicity of calling a static function with a concatenation of whatever I want is what I crave. Is there any way to satiate the operator+ with the double value?
You could, but I’d limit the overloads to always having a const FString& on the left hand side.
Alternatively, how about something like this? This puts the overloads onto a custom type (FLogLine), and uses it as a scoped object returned from FLogger::Log to handle writing out a line of log text when the object falls out of scope.
this goes beyond my current knowledge. gonna need some time understanding that txt of c++ goodness i will keep trying to figure out a way to overload operator+ for my cases thank you