
Hi Yakov,
It's not just for saving typing, it's for making the interface more generic. Consider the following: <snip> Ok, so the above is longer than the first because we didn't define a nice interface of str_ref yet, but it demonstrated the generality.
This is all true, but it's important to keep in mind our use cases. In general, these APIs will be called with string literals. The next-most-common case is for them to be called with std::strings, and other cases are even less likely. So it seems best to do the simplest thing possible which covers the common cases and does not rule out the uncommon ones.
Note that the most general way is to use templates accepting any Range of chars, just as boost string algorithms do. But this is not good for separate compilation, so the above is the best compromise of efficiency, separate compilation and generality we can get.
Your compromise is missing one factor - simplicity. This is a simple API which does a simple job. Decorating it with generic tools will make it harder to understand and to maintain, in exchange for some small benefit in uncommon use cases. In any case, it's Vladimir's library, so he has the last word on this. Thanks, -Gabe