martinmoene / span-lite

span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
495 stars 40 forks source link

Construct span from a pair of iterators #54

Closed slsyy closed 4 years ago

slsyy commented 4 years ago

The following code does not compile:

#include <vector>
#include <span>
#include <https://raw.githubusercontent.com/martinmoene/span-lite/master/include/nonstd/span.hpp>

#define s nonstd::span
// #define s std::span

void consume(s<int>);

int main () {
    std::vector a{1, 2, 3};

    consume(s(a.begin() + 1, a.end()));
}
martinmoene commented 4 years ago

"The following code does not compile" seems to hold for both std::span and nonstd::span, see this code at godbolt.

martinmoene commented 4 years ago

@slsyy can this issue be closed?