Sign in to follow this  
Finalspace

Why using std::string when you can create it yourself...

Recommended Posts

I love it.  But why only one kind of custom string?  

 

You need one version that uses custom memory managers. You need another version that stores the string inside what would normally be the pointer if the string is small, you need a copy-on-write version, and you need a container-like string that is backed by a temporary file on disk or network rather than kept in memory all the time.

 

Seems like every major library includes their own variations of the string. 

Share this post


Link to post
Share on other sites

This is the reason why my rendering demo was crashing all the time, when it was rendering text based of this "nice" string implementation biggrin.png

 

I think i was at a brink to just forcing myself to write everything myself... for learning purposes...

 

 

Or a single template version that does all those variations based on policy classes.

 
Templates you say.... at the time, i had no f...... glue what templates are - it was that magic voodoo stuff biggrin.png
Edited by Finalspace

Share this post


Link to post
Share on other sites

I love it.  But why only one kind of custom string?  

 

You need one version that uses custom memory managers. You need another version that stores the string inside what would normally be the pointer if the string is small, you need a copy-on-write version, and you need a container-like string that is backed by a temporary file on disk or network rather than kept in memory all the time.

 

Seems like every major library includes their own variations of the string. 

 

Don't forget the variant that only gets used when the string comes from the localization table. Oh, and all the variants are actually in the same class despite the fact that their behavior is subtly different, and you can only know which is which by looking not only at the place where any particular string was initialized, but ALSO looking in the localization table to determine if that string is defined properly for that particular language.

Share this post


Link to post
Share on other sites
I hope you don’t mind, Finalspace, but we at Square Enix have really fallen in love with your code and believe it is the path to the future.
We’ve replace our own string classes with yours and will be shipping the trial version of Final Fantasy XV this month with your code.

Thanks for your contributions!


L. Spiro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this