If there is one thing that’s completely banned from the Molecule Engine, it’s dynamic strings. I’ve always cringed at how many string operations and string-based look-ups where done in the last codebase I’ve been working with, hence I wanted to get completely rid of them in the run-time part of the engine – no exceptions.
You don’t need dynamically sized strings when dealing with filenames. All files need to be compiled by the content pipeline anyway, so just store a hash of the filename inside your datafiles, .pak-files, big-files, whatever. No need for strings, resolve collisions at asset compile-time. Furthermore, users (artists, designers, and programmers) shouldn’t load assets/resources by using a filename, but rather a unique identifier instead – which is conveniently handled by the content pipeline in Molecule, so no strings needed there either.
You don’t need strings as identifiers – they are error-prone, it’s easy to get them wrong, and they don’t achieve anything which can’t be achieved otherwise. Use hashes, enums, or simple integers instead.
You don’t need strings for parsing files. Parse them in-place, there’s no need to dynamically allocate memory for them. I still remember situations where the XML-parser would do more than 1 million individual allocations (!) when parsing a file – not very nice, and certainly not high-performance.
On a related note, you don’t need a std::map using a std::string as a key, there are more superior data structures for that. By “more superior” I don’t mean a hash-table either, because most of the time a simple array (or something slightly more advanced) will suffice and beat the crap out of every map and/or hash-table implementation. There, I said it.
That being said, the only place I use dynamic strings in the Molecule Engine is inside the logging mechanism, where a FixedSizeString<512> on the stack is more than enough to deal with that. Again, no dynamic allocations needed.
So far, I haven’t used any hash-table, map or dynamic string in Molecule yet (and I certainly won’t), and life’s good without them, both memory- and performance-wise. I never had the urge to use them.