
On Mon, Aug 15, 2011 at 9:33 PM, Gabriel Redner <gredner@gmail.com> wrote:
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.
Using str_ref would require only a single overload, while using const char* and const str::string& would require two. So what is the simplest thing possible?
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.
This isn't the only lib that takes string references. It'd be nice to solve this properly once and for all. Olaf