Page MenuHomePhabricator

Fully support std::basic_string and casting to it
ClosedPublic

Authored by jcmcdonald on Mar 6 2021, 7:47 PM.

Details

Summary
  • Allows casting to std::string and other std::basic_string variants.
  • Actually caches c_str, which is invalidated on mutation.
  • No longer need to delete[] or free[] on return from c_str (it's a const pointer)
  • All operations are now fully compatible with all variants of std::basic_string, not just std::string
Test Plan

Build branch and ensure it works with SIMPLEXpress still.

Diff Detail

Repository
rONE Onestring
Lint
Lint Not Applicable

Event Timeline

Restricted Application completed remote builds in Restricted Buildable.Mar 6 2021, 7:47 PM
jcmcdonald retitled this revision from Fully support basic_string<> and casting to it to Fully support std::basic_string and casting to it.Mar 6 2021, 7:50 PM

Nice! With this I don't have to explicitly cast my onestring in Ratscript to compare to the std::string hashmap at all (I can't make a hashmap with onestring directly, overwrote my previous paste at P60 with that error if you're curious....If I understand it right, it's because onestring doesn't come with a hash function), it just works.

SIMPLEXpress also compiles and all tests pass with no modifications.

This revision is now accepted and ready to land.Mar 8 2021, 12:59 PM

Excellent, I'll land this, then!

Hmm...a hash function. I'll have to see if I can provide one.