basic_const_iterator doesn't work with optionalSection: 24.5.3 [const.iterators] Status: New Submitter: Hewill Kang Opened: 2023-08-26 Last modified: 2023-10-30
Priority: 3
View other active issues in [const.iterators].
View all other issues in [const.iterators].
View all issues with New status.
Discussion:
The heterogeneous comparison operators of basic_const_iterator only constrain type I to be
comparable with the underlying iterator type, which allows non-iterator types such as optional, and
the heterogeneous comparison operators of the latter would make the situation worse
(demo):
#include <iterator>
#include <optional>
int main() {
std::basic_const_iterator<const int*> it;
std::optional opt{it};
auto c = opt < it; // infinite meta-recursion
auto d = it - opt; // infinite meta-recursion
}
[2023-10-30; Reflector poll]
Set priority to 3 after reflector poll.
Proposed resolution: