3907. Can iterator types of range adaptors and range factories be SCARY?

Section: 26.6 [range.factories], 26.7 [range.adaptors] Status: New Submitter: Jiang An Opened: 2023-03-18 Last modified: 2023-06-01 14:48:40 UTC

Priority: 3

View all issues with New status.


[For the term SCARY see N2911 and N2913.]

In 26.6 [range.factories] and 26.7 [range.adaptors], many iterator types are specified as exposition-only nested classes or nested class templates.

This has some observable differences from specifying them as class templates declared in the namespace scope:

  1. value types are generally not associated entities of iterators or sentinels during ADL, which prevents unintended overloads to be found;

  2. two different range adaptor/factory types, e.g. iota_view<I, S1> and iota_view<I, S2>, have different iterator types.

The ADL reduction seems preferable. However, is it intended to required to any two different range adaptor/factory types to have two different iterator types, even when the same iterator type can work as expected?

Sentinel types don't seem able to be SCARY as they are dependent on iterator types.

[2023-06-01; Reflector poll]

Set priority to 3 after reflector poll.

"The ADL hiding stuff is a red herring - SCARY-ness doesn't prevent ADL hiding. Shouldn't require them to be different types (and similarly should not require const/non-const iterators to be implemented as class templates with a single bool template parameter)."

Proposed resolution: