-
Notifications
You must be signed in to change notification settings - Fork 126
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
Use std::span() #87
Comments
Hey, thanks for the suggestion. I know after 10 years this still claims to be a "modern" C++ library, but it is actually compatible with C++14. I still have a lot of legacy projects that use it, and they will likely never have a compiler upgrade. I was considering updating to C++17 in a near-future release, but no plans for C++20 at the moment. It doesn't seem worth it to phase out a lot of legacy and embedded code for small changes like pair vs span, even if they would be nice. But maybe some conditional compilation based on the compiler version? I don't know if that would get confusing. |
Ha. It's been a while since I was deep into this library, that I forget the implementation details! I grep'ed through the code and it seems I'n not using std::pair<> anywhere in the library. The term "pair" is used in the library to return to a pair of sockets derived from the C socket library call Those are actually returned in C++ in a 2-element tuple, I think span wouldn't work here since it's a non-owning container, right? |
I think best way is to provide you own simplified implementation (only with |
Or use span from MS GSL https://github.com/microsoft/GSL/blob/main/include/gsl/span |
Yes, span is not owning. It just array slice :), but with helper methods that allow to get sub-span that often very helpful |
Could you give me an example, specifically, of what you think should be changed? |
So you could use |
Oh, OK. Now I get you. I would not want to break backward compatibility to replace the existing functions, but maybe we can add those with conditional compilation for C++20?
|
Yeah, it's ok. But probably also support ms GSL span implementation for C++14-17. BTW |
I could see it maybe as an opt-in CMake build option. It's not something I would have the time or inclination to do in the near future, but if you send over a PR, I'd give it a look. |
|
Yes, of course you're right. It should not be a span of But honestly, I'm not yet convinced of But that also shows the problem with using something like |
This is exactly what I guess |
I like library interface very much, but it should use std::span(void *)/std::span(const void *) in lot of methods instead of pair (void *buf, size_t n)/(const void *buf, size_t n)
The text was updated successfully, but these errors were encountered: