-
Notifications
You must be signed in to change notification settings - Fork 742
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
MSVC - gsl::make_span with iterators #982
Comments
I'll take a look at it to see if there are any work arounds or fixes that we can make on the GSL side. Would you mind creating an issue for this on the Developer Community? Please note in the issue that the code compiles properly with both Clang and GCC. Thanks |
@JordanMaples Why should dingari open an issue on Developer Community? This issue is a GSL issue, not an STL issue and not a compiler issue. A container's If you change the A proper fix would be to add an overload for |
@beinhaerter it makes sense that attempting to make I'm guessing the GCC and Clang stdlib implementations are implicitly casting Nevertheless, having an overload taking iterators and making sure that they're actually pointing to a contiguous area in memory would be really helpful. How that would be achieved is beyond my grasp, but C++20 seems to add For context: in our use-case, we're doing a lot of work with stack-allocated @JordanMaples I'm up for anything, but I just thought raising a Github issue would suffice, since it seems to be a GSL issue (like @beinhaerter mentioned). |
I didn't realize that Clang/GCC gave the option to return as a pointer and assumed it was a different issue. In that case, don't file a Developer Community bug. In general, we've been recommending against using If either of you would like to put out a PR to address this, I'll gladly review it. |
Absolutely. My comment about the |
Maintainers call: C++20 includes a |
@gdr-at-ms can you take a look at this? |
I have some code that uses
gsl::make_span(cont.begin(), cont.end())
quite heavily. This compiles fine on macOS and Linux with GCC and Clang, but fails on MSVC. Instead, I have to usegsl::make_span(cont.data(), std::distance(cont.begin(), cont.end()))
- which becomes pretty tedious and illegible.Here's a quick example. Is there another overload we can use?
We can't pass the whole container to
make_span
, since we sometimes have varying end iterators returned from algorithms.The text was updated successfully, but these errors were encountered: