-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__bit_iterator
is missing operator->
#111032
Comments
Is this a bug?
From what I understand this iterator type can't really meet the requirements it's supposed to, so perhaps not supporting the arrow operator as well is alright. libstdc++ and MSVC's standard library also don't provide arrow operator support for Lets suppose struct fixed_iterator:std::vector<bool>::iterator{
struct pointer{
std::vector<bool>::reference ref;
pointer*operator->(){
return this;
}
void flip(){
ref.flip();
}
};
pointer operator->()const{
return pointer{**this};
}
}; This code seems to work to support this use case https://godbolt.org/z/7TvceKGWM, while not supporting invalid uses like calling the destructor of reference or value_type. So I think supporting the arrow operator is possible, though it shouldn't make |
In the view of C++20 iterators, I think If we make
Agreed. I don't think the original issue is a bug either.
I think this should be right. But the standard wording is somehow underspecified on the At this moment I agree on supporting |
That sounds like a good idea, by the way a lot of the range adapators in C++20 don't support the arrow operator and define iterator_category anyway. For example: int x[]{1,2,3};
auto v=std::views::zip(x);
auto i=std::ranges::begin(v); The expression |
Cpp17InputIterator requires
a->m
to be a valid production, which__bit_iterator
lacks. Althoughbool
doesn't have any members to access,it->~value_type()
should still be valid due to pseudo-destructors.The text was updated successfully, but these errors were encountered: