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
{{ message }}
Repository navigation
dyn_array_iterator lacks the random access iterator operators it declares #1270
dyn_array_iterator declares iterator_category = std::random_access_iterator_tag but supplies none of operator<, operator>, operator<=, operator>=, operator-> or n + it, and its default constructor exists only when __cpp_lib_ranges is defined. Any algorithm that relies on the declared category fails to compile:
gsl::dyn_array<int> a{3, 1, 2};
std::sort(a.begin(), a.end()); // error: no match for operator<bool b = a.begin() < a.end(); // same
gsl::dyn_array<int>::iterator it{}; // error before C++20
Reproduces on main (417ef68) with GCC 15 at C++14, 17 and 20 (the default constructor case at 14 and 17). A default constructor is part of the forward iterator requirements in every standard the library supports, and the relational operators, -> and n + it are part of the random access requirements.
Thanks for reporting this issue! This was definitely an oversight, and it prevents gsl::dyn_array from being turned into a std::span. I appreciate you putting up a PR to resolve the issue.
Activity
carsonRadtke commentedon Sep 10, 2026
Thanks for reporting this issue! This was definitely an oversight, and it prevents
gsl::dyn_arrayfrom being turned into astd::span. I appreciate you putting up a PR to resolve the issue.