C++ Logo

std-discussion

Advanced search

Hostile member type element_type breaks C++20 iterator-ness

From: F. v.S. <de34_at_[hidden]>
Date: Tue, 29 Apr 2025 01:44:42 +0000
Per current specification of std::iter_value_t, if a class type with proper member type value_type meets some C++17 iterator requirements (Cpp17InputIterator or a stronger one) but has an inconsistent member typedef element_type (e.g. void), it doesn't satisfy the std::input_iterator concept (or a stronger one) because std::iter_value_t isn't valid for that type.

Is such treatment intended? If not, perhaps there should be an LWG issue to specify that I::element_type is not detected when I::value_type is a valid type.

Thanks,
F.v.S.

Received on 2025-04-29 01:44:47