Also, would it be possible to add a test for it, like we do for operator*?
Could you add views::single at the same time? It's pretty small so it makes sense to implement both in the same go, I think.
Also, this makes me think that we don't have views::empty, right?
Here you could use __value_(std::in_place, __t) instead, and you would not have to modify __copyable_box. Same for the rvalue ref below.
Since the spec documents this as being static, can you add a test that std::ranges::single_view<int>::size() works as well?
If you're going to take @ldionne up on this (and I think you should), please DM me so we can discuss a cohesive design for the adaptor closures. I don't want us to have wildly different ideas about what goes in this namespace.
Unless there are already tests in ranges::size for static members, is it worth adding a test here for ranges::size too?
LGTM with all comments applied and CI passing.
views::single is not a range adaptor object, so we still are not implementing the pipe operator. But regardless, let's chat on Discord since you seem to have a specific approach in mind for the pipe operator.
I really like that you're testing this property of the type, thanks for being thorough.
I'm not sure I understand your comment. Are you asking that we should add a test for ranges::size() on a type that provides a static size() method? If that's your suggestion, I would agree. It's actually a hole in our current testing coverage, since the spec for ranges::size() basically says "use x.size() if that is valid", which does not specify whether .size() is a static or non-static member function.
So as a fly-by fix in this patch, @zoecarver can you add a test in ranges::size() with a type that defines a static size() function?
So it appears that the assign test crashes on GCC trunk! Anyway, I filed a bug (id = 101663), and I'll mark this test as unsupported on GCC.
Thank you :)