[libc++] [ranges] SFINAE-friendly "write it three times" in views::counted.
Before this patch, the new test's `CountedInvocable<int*, int*>` would hard-error instead of SFINAEing and cleanly returning false. Notice that views::counted specifically does NOT work with pipes; `counted(42)` is ill-formed. This is because `counted`'s first argument is supposed to be an iterator, not a range. Also, mark `views::counted(it, n)` as [[nodiscard]], and test that. (We have a general policy now that range adaptors are consistently marked [[nodiscard]], so that people don't accidentally think that they have side effects. This matters mostly for `reverse` and `transform`, arguably `drop`, and just generally let's be consistent.) Differential Revision: https://reviews.llvm.org/D115177
Loading
Please sign in to comment