-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make BasicStringRef
compatible with std::experimental::string_view
#100
Comments
Unfortunately, Both There are 2 approaches to fix this issue:
There are other issues/improvements in BasicStringRef:
Sorry for my bad English. Let me know if my words are hard to understand. |
I also prefer option (2) for the same reason. As for other improvements to P.S. I think your English is just fine. |
Here is a WIP branch, which deprecates c_str(): All unit tests passed though. The problem is: when I looked into the implementation detail, some code can be replaced directly, but code like https://github.com/cppformat/cppformat/blob/master/format.cc#L1066 and https://github.com/cppformat/cppformat/blob/master/format.h#L245 does assume that the referenced string buffer is NUL-terminated. Fixing them is not an easy work. |
The comparison and Also, I suggest keeping The cases like explicit FormatError(StringRef message)
: std::runtime_error(message.c_str()) {} should be pretty straigtforward to update: explicit FormatError(StringRef message)
: std::runtime_error(message) {} since Thanks for working on this! |
New headers removed. |
From #159:
|
BasicStringRef
compatible with std::experimental::string_view
On further investigation it appears that getting rid of |
and use it instead of BasicStringRef in cases that assume that the string is null-terminated such as POSIX function and format string parser.
Fixed the main issue by adding As a nice side-effect the per-call overhead is somewhat reduced bringing C++ Format even closer to
instead of
which is only 3 bytes more than
|
Migrated the issue with comparison operators to #183. |
From reddit:
The text was updated successfully, but these errors were encountered: