Your parentheses are in the wrong place. Did that even compile??
You also don’t need the String cast (really don’t understand why it seems so common for people to wrap all their string literals in String constructors…)
Using String cast feels naturally for some reason (May some other frameworks uses this approach … ). Maybe this need written down to FMB (Frequently made bugs section)
Yeah, it’s not really a bug, just a bad habit that makes code less readable and occasionally makes it slower (e.g. in your code above, it would create an unnecessary intermediate string object because the function expects a StringRef). I’m just a bit puzzled because I see it really often, and don’t know why anyone would start doing it, as I’d have thought most people’s instinct would be to first just type the literal… Ah well.
I have some external tools which will choke on Windows if I use operator+ in a Logger::writeToLog() with string literals… so I have to make them into String objects… otherwise I don’t unless I need to use a String method on a literal.