mcy / best

The Best Library: a C++ STL replacement
Apache License 2.0
158 stars 1 forks source link

Move almost all view functions on `best::vec` and `best::strbuf` behind `operator->` #25

Closed mcy closed 2 months ago

mcy commented 2 months ago

This patch introduces best::arrow<T>, a helper for returning anything out of an operator->. The doc comment on the type explains why it exists and what C++ semantics it abuses.

best::vec and best::strbuf now have operator->s that effectively return best::span and best::str, respectively. This allows the removal of a ton of duplicated functions, and means that the owned types can't "lag" behind the unowned types! This also means that e.g. best::box<T[]> does not need to duplicate all of the functions from best::span, like to best::vec used to.