You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C++20 introduced both std::contiguous_range and std::continous_iterator concepts, that are the generalization of the pointer to continuous sequence of objects, and type erased view for such ranges in form of std::span.
However, these two features are not integrated together, as consequence std::span cannot be directly constructed from ranges that models std::contiguous_range and std::sized_range, nor from the pair of std::continous_iterator:
std::vector v{...};
std::span s = v; // OK
std::span s = v | std::take_view(10); // ILL-FORMED
std::span s(std::to_address(v.begin()), 2); //OK
std::span s(std::to_address(v.begin()), std::to_address(v.begin() + 2)); //OK
std::span s(v.begin(), 2); // IMPLEMENTATION-DEFINED
std::span s(v.begin(), .begin() + 2); // IMPLEMENTATION-DEFINED