#982·GSL

MSVC - gsl::make_span with iterators

Author: dingariCreated May 11, 2021Updated Dec 27, 2025
LabelsPriority: LowType: BugStatus: In Progress

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 use gsl::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.