
On Mon, Aug 15, 2011 at 10:25 PM, Olaf van der Spek <ml@vdspek.org> wrote:
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?
Not using str_ref would require a third overload: (const char*, size_t). Even then, it still doesn't support for example vector<char>, CString (MFC) or QString (QT). Olaf