23 points · by syvex · 12y ago · 6 comments
Another bonus is faster hashing. If a string literal is given to istring, then the hash is computed at compile time! Other strings will have their hashes cached for later use. The istring is designed more or less after the python string in this regard.
It should also consume less memory than std::string and perform faster in all other areas.
[1] http://stackoverflow.com/questions/16123446/java-7-string-su...
[2] http://www.reddit.com/r/programming/comments/1qw73v/til_orac...
In principle, you use it similar to python--s(5,10) instead of s[5:10].
I would have maybe liked to end up with s[5,10], but the only way to overload operator[] like that is with a pair. Then you'd end up with s[{5,10}]. So I figured it would be best to stick with just s(5,10).