This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

### 3377. `elements_view::iterator` befriends a specialization of itself

Section: 24.7.18.3 [range.elements.iterator] Status: C++20 Submitter: Casey Carter Opened: 2020-01-18 Last modified: 2021-02-25

Priority: 0

View all other issues in [range.elements.iterator].

View all issues with C++20 status.

Discussion:

The synopsis of the exposition-only class template `elements_view::iterator` in 24.7.18.3 [range.elements.iterator] includes the declaration "`friend iterator<!Const>;`". We typically don't depict such friend relationships in the Library specification, leaving the choice of how to implement access to private data from external sources to implementer magic. For consistency, we should strike this occurrence from `elements_view::iterator`.

[2020-02-08 Status set to Tentatively Ready after ten positive votes on the reflector.]

Proposed resolution:

This wording is relative to N4842.

1. Modify 24.7.18.3 [range.elements.iterator], class template `elements_view::iterator` synopsis, as indicated:

   >     namespace std::ranges {
   >       template<class V, size_t N>
   >       template<bool Const>
   >       class elements_view<V, N>::iterator { // exposition only
   >         using base_t = conditional_t<Const, const V, V>;
   >         friend iterator<!Const>;

   >         iterator_t<base_t> current_;
   >       public:
   >         […]
   >       };
   >       […]
   >     }