-
Notifications
You must be signed in to change notification settings - Fork 410
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
Add back port of std::span #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(It's mildly confusing that span
here does not refer to an OTel Span!)
But at least it's in a separate namespace -- and it's worth it to match the names in the standard library |
T *end() const noexcept { return data_ + extent_; } | ||
|
||
private: | ||
// Note: matches libstdc++'s layout for std::span |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious - is this a best effort or we want to keep the layout compatibility as a promise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a best effort. It also varies by standard library. For example, libc++ uses a different order
https://github.com/llvm-mirror/libcxx/blob/master/include/span#L520-L521
{ | ||
if (count != Extent) | ||
{ | ||
std::terminate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this introduce a dependency on stdlib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By stdlib, do you mean the standard c library?
std::terminate would be defined in the standard c++ library; and unless, you change the terminate handler with std::set_terminate, it will forward to abort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libstdc++
I remember we discussed about whether we should have dependency on the standard c++ library but we haven't got the conclusion. I'm curious to know if someone could see the downside of having libstdc++ dependency (e.g. static link scenario?)
https://github.com/grpc/proposal/blob/master/L59-core-allow-cppstdlib.md
commenting out trace state in span context
[MISC] Use set -e on all shell scripts and pass shellcheck --severity…
Like std::string_view this is another basic non-owning vocabulary type.