WIP: Consider C++17 string_view #80
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is more a WIP and discussion for design.
Cxx looks great but I think there are some things we can consider or use regarding absl (unlikely unless we add options or sub crates for customization) and the standard.
A few things that pop out would be span types and string_view
How do we discover CXX features?
In the WIP PR I threw together (sorry was quick to get a discussion), I stole the absl detection code for figuring out if string_view exists in the compilation environment, and if so uses that instead of
const char*
/std::string
as the constructor for::Str
. string_view is compatible with both callings of the constructor and has very similar semantics to::Str
and the internal representation.Naturally for a none C++17 and onwards environment I figure we drop back to what is already there, or maybe suggest the use of absl as a bridging library.
Do we have any thoughts here, if wanted we could add in a few bridiging types that are forthcoming in newer versions of c++