[clang] [libc++] Implement ranges::iota (PR #68494)

James E T Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 12:31:04 PDT 2023


jamesETsmith wrote:

Making the operations conditionals was pretty straightforward, but `using difference_type = std::iter_difference_t<T>` is causing problems because it requires that all `T` types implement `T::difference_type` which I think is too strong a requirement. For example, this will cause `Proxy<MoveOnly>` to crash because `MoveOnly` doesn't implement `difference_type`. 

My gut reaction was to try and make that alias require a concept, but the more I try to get something like a "conditional alias" to work the more it feels like that isn't allowed and I'm thinking about this the wrong way. Do you have any suggestions @philnik777?

Here's an updated minimal example showing the crash that I'm talking about: https://godbolt.org/z/KocGjhPhz

https://github.com/llvm/llvm-project/pull/68494


More information about the cfe-commits mailing list