https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116399
--- Comment #17 from 康桓瑋 <hewillk at gmail dot com> --- (In reply to Jonathan Wakely from comment #15) > (In reply to 康桓瑋 from comment #13) > > I'm not sure it's reasonable or trivial for alias_view to be sized_range, > > I don't think it is necessary. Is there a use case for needing to know how > many aliases there are, where ranges::distance isn't sufficient? What code > would you write differently? > > > If it's trivial to make it satisfy sized_range, then perhaps we should > > submit to the LWG to require it. > > It would require inspecting the aliases on construction, and then storing > the size (or the end iterator). That would mean > std::text_encoding::aliases() is not O(1). > > Why would it be an improvement? The random-access-non-sized ranges in the standard are currently only infinite ranges such as views::iota(0). Random access is useful for these ranges because we can random access any place without worrying about out-of-bounds. However, for random-access-non-infinite ranges, only simply providing random access does not seem to be of much use, because we always need to know its size via ranges::distance before performing random access operations to avoid out-of-bounds.
