You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition, many projects have their own implementation of string_view.
I noticed your StringRef class contains a method called c_str(). If you are following the STL paradigm, the existance of this method means that your StringRef class has an invariant that must always reference a null terminated string and therefore the formatting functions require the format string to be null terminated.
Is this the case?
If not, I would suggest renaming StringRef::c_str() to StringRef::data(). I'd also add whether or not null termination is required on the format string to the documentation.
If you are planning to support non-null terminated format strings, a constructor accepting a std::experimental::string_view (conditionally enabled with the __cpp_lib_experimental_string_view macro) with also help people using string_view use your library.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. Replacing StringRef::c_str() to StringRef::data() is already on my TODO list (#100). I'll add a note regarding std::experimental::string_view there.
std::string_view is slated for C++17 and there is already support for a std::experimental::string_view.
http://en.cppreference.com/w/cpp/experimental/basic_string_view
In addition, many projects have their own implementation of string_view.
I noticed your StringRef class contains a method called c_str(). If you are following the STL paradigm, the existance of this method means that your StringRef class has an invariant that must always reference a null terminated string and therefore the formatting functions require the format string to be null terminated.
Is this the case?
If not, I would suggest renaming StringRef::c_str() to StringRef::data(). I'd also add whether or not null termination is required on the format string to the documentation.
If you are planning to support non-null terminated format strings, a constructor accepting a std::experimental::string_view (conditionally enabled with the __cpp_lib_experimental_string_view macro) with also help people using string_view use your library.
The text was updated successfully, but these errors were encountered: