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
497 stars 41 forks source link

Constructor from iterators is not properly constrained #69

Closed krsch closed 3 years ago

krsch commented 3 years ago

Example: https://godbolt.org/z/9MTYWPYqG Fails with span-lite, works with std::span (e.g. by enabling -std=c++20) The problem is that int& is convertible_to float const&. This is not true for int* and float const* so I think pointers can be used in span_REQUIRES_T on line 956, but I'm not sure if this solution has no other bugs.

martinmoene commented 3 years ago

Thanks!