llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[libc++] `__wrap_iter` doesn't need member type `iterator_type`

Open frederick-vs-ja opened this issue 8 months ago • 3 comments

Follows-up #126442.

__wrap_iter is provided as contiguous iterator types of some containers and views, in order to prevent users relying on the iterator types being raw pointers. However, we've been extraneously providing a member type iterator_type, which is unnecessary for the standard requirments.

https://github.com/llvm/llvm-project/blob/cd0d7b427d77810a3e804338b5a53ede0c7831a7/libcxx/include/__iterator/wrap_iter.h#L37

Member iterator_type is observable to users, and users possibly rely on it, which slightly defeats the intent of __wrap_iter. Perhaps it would be better to remove iterator_type although it's a conforming extension.


I think the removal of iterator_type can be https://github.com/llvm/llvm-project/labels/good%20first%20issue as one can just remove that line and change every iterator_type in <__iterator/wrap_iter.h> to _Iter.

Change should be mentioned in the release notes, though. https://github.com/llvm/llvm-project/blob/cd0d7b427d77810a3e804338b5a53ede0c7831a7/libcxx/docs/ReleaseNotes/23.rst#L58-L59

frederick-vs-ja avatar Mar 16 '26 13:03 frederick-vs-ja

Hello, can I be assigned to this?

nkotikal avatar Mar 16 '26 13:03 nkotikal

Hello, can I be assigned to this?

You don't need to be assigned and can just open a PR for this.

frederick-vs-ja avatar Mar 16 '26 14:03 frederick-vs-ja

Thank you, I've made a PR and linked it to this issue.

nkotikal avatar Mar 16 '26 21:03 nkotikal