Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reverse.iter.requirements] Avoid saying 'global operators' #442

Merged
merged 1 commit into from Jun 22, 2016

Conversation

cpplearner
Copy link
Contributor

N4296 24.5.1.2/2 says

Additionally, Iterator shall meet the requirements of a Random Access Iterator (24.2.7) if any of the members operator+ (24.5.1.3.8), operator- (24.5.1.3.10), operator+= (24.5.1.3.9), operator-= (24.5.1.3.11), operator [] (24.5.1.3.12), or the global operators operator< (24.5.1.3.14), operator> (24.5.1.3.16), operator <= (24.5.1.3.18), operator>= (24.5.1.3.17), operator- (24.5.1.3.19) or operator+ (24.5.1.3.20) are referenced in a way that requires instantiation (14.7.1).

The operator<, operator>, operator <=, etc mentioned here do not live in the global namespace, but the current wording can be read as implying so.

These operator functions are not in the global namespace scope.
@jwakely
Copy link
Member

jwakely commented Apr 14, 2015

Your suggestion is an improvement but it still seems wrong to me, operator< could be a member. We could talk about unary/binary operators not member/non-member, but since the rule applies to both unary and binary forms of operator+ and operator- we don't really need to distinguish between them at all.

@cpplearner
Copy link
Contributor Author

That operator< (described in 24.5.1.3.14[reverse.iter.op<]) is declared as a non-member. I don't think an implementation is allowed to declare it as a member.

I agree that there's no need to distinguish between members and non-members here.

24.5.3.2[move.iter.requirements] reads

The template parameter Iterator shall meet the requirements for an Input Iterator (24.2.3). Additionally, if any of the bidirectional or random access traversal functions are instantiated, the template parameter shall meet the requirements for a Bidirectional Iterator (24.2.6) or a Random Access Iterator (24.2.7), respectively.

Perhaps 24.5.1.2[reverse.iter.requirements] could be phrased in a similar way. I mean, 24.5.1.2/2 could simply say

Additionally, if any of the random access traversal functions are instantiated, the template parameter shall meet the requirements for a Random Access Iterator (24.2.7).

@tkoeppe
Copy link
Contributor

tkoeppe commented Dec 21, 2015

@cpplearner: Are you still interested in pursuing this PR?

@tkoeppe
Copy link
Contributor

tkoeppe commented May 31, 2016

@zygoloid, @jwakely: Close this PR as abandoned?

@villevoutilainen
Copy link
Member

Here's a p/r: globalnamespace scope operators

@zygoloid zygoloid merged commit ed0cd28 into cplusplus:master Jun 22, 2016
@cpplearner cpplearner deleted the patch-4 branch June 22, 2016 17:20
FrankHB pushed a commit to FrankHB/draft that referenced this pull request Jul 9, 2016
These operator functions are not in the global namespace scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants