This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
Section: 184.108.40.206 [move.iter.cons], 220.127.116.11 [reverse.iter.cons] Status: WP Submitter: Casey Carter Opened: 2020-04-26 Last modified: 2020-11-09
View all other issues in [move.iter.cons].
View all issues with WP status.
Despite that reverse_iterator<int*> and reverse_iterator<const int*> are comparable with <=>, three_way_comparable_with<reverse_iterator<int*>, reverse_iterator<const int*>> is false. This unfortunate state of affairs results from the absence of constraints on reverse_iterator's converting constructor: both convertible_to<reverse_iterator<int*>, reverse_iterator<const int*>> and convertible_to<reverse_iterator<const int*>, reverse_iterator<int*>> evaluate to true, despite that reverse_iterator<int*>'s converting constructor template is ill-formed when instantiated for reverse_iterator<const int*>. This apparent bi-convertibility results in ambiguity when trying to determine common_reference_t<const reverse_iterator<int*>&, const reverse_iterator<const int*>&>, causing the common_reference requirement in three_way_comparable_with to fail.I think we should correct this by constraining reverse_iterator's conversion constructor (and converting assignment operator, while we're here) correctly so we can use the concept to determine when it's ok to compare specializations of reverse_iterator with <=>. move_iterator has similar issues due to its similarly unconstrained conversions. We should fix both similarly.
[2020-07-17; Priority set to 2 in telecon]
[2020-07-26; Reflector poll]
Set status to Tentatively Ready after five votes in favour during reflector discussions.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
This wording is relative to N4861.
Modify 18.104.22.168 [move.iter.cons] as indicated:
[Drafting note: this incorporates and supercedes the P/R of LWG 3265.]
Constructs a move_iterator, value-initializ ingcurrent. Iterator operations applied to the resulting iterator have defined behavior if and only if the corresponding operations are defined on a value-initialized iterator of type Iterator.constexpr explicit move_iterator(Iterator i);
Constructs a move_iterator, initializ ingcurrent with std::move(i).template<class U> constexpr move_iterator(const move_iterator<U>& u);
Mandates: U is convertible to Iterator. Constructs a move_iterator, initializ ingcurrent with u. base().template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
-5--6- Effects: Assigns u.
Mandates: U is convertible to Iterator. base()to current.
Modify 22.214.171.124 [reverse.iter.cons] as indicated:
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
-3- Effects: Initializes current with u.current.template<class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u);
-4- Effects: Assigns u.
base()to current. -5- Returns: *this.