electronicarts / EASTL

EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.
BSD 3-Clause "New" or "Revised" License
7.82k stars 905 forks source link

Add automatic conversion between std::string_view and eastl::string_view #496

Closed W4RH4WK closed 6 months ago

W4RH4WK commented 1 year ago

While eastl containers are interoperable with std algorithms thanks to iterators, strings are typically not handled through iterators. Converting an eastl string to an std string is problematic and string_views are a better tool for this.

This commit adds automatic conversion between std::string_view and eastl::string_view.

The feature (and corresponding unit test) is guarded by EASTL_STRING_VIEW_STD_CONVERSION_ENABLED. Let me know where to add EASTL_STRING_VIEW_STD_CONVERSION_ENABLED such that it is correctly picked up by testing facilities.