Download

Annoying Differences to STL

I’m finding it a little annoying when basic data structures use terminology and method names which are different to STL.

For example:
[FONT=Courier New]FString::IsEmpty() === [FONT=Courier New]std::string::empty()
[FONT=Courier New]FString::Empty() === [FONT=Courier New]std::string::clear()

When I do [FONT=Courier New]if(myString.Empty()), I do not expect this to modify myString.

It would be nice if stuff like this lined up better.
However, I appreciate it is probably already much too late to do anything about this - and best names is something of a subjective issue anyway…

Sure I could just use std::string instead, but I’d rather not bring in those dependencies.

Oh well.

That’s not really a dependency, is it? Every modern compiler has a good STL implementation, and you’re very likely to be using at least part of it, especially now with all the fun new toys in C++11.

I assume the UE4 versions are better optimized for performance-critical situations, but for the most part I’d stick with the STL for game logic and everything else which isn’t directly using the engine.

Why not just change it in Core to what you prefer?

I would personally avoid mixing STL with UE4 … but nothing would stop you from using it.

I agree, the documentation of FString::Empty sounds more like a static function and not like a clear.

“Create empty string of given size with zero terminating character”