cplusplus / cplusplus/draft

[over.oper.general] Remove paragraph 8 and make [over.xxx] more self-contained

Open
#6,974 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3-Other
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

For a moment, I was wondering whether operator() can be a free function, and it's not as obvious as it could be because of how inelegant the ban is:

  • operator() is an operator function by definition.
  • It has to be a function call operator function (or other special kind) because of [oper.over.general] p8.
  • A function all operator function is an operator() that is also a member function.
  • By exhaustively looking through all possible kinds of operator functions and finding that a free operator() is none of them, we can conclude that it cannot be a free function.

This is very convoluted compared to [over.ass] p1:

A simple assignment operator function is a binary operator function named operator=.
A simple assignment operator function shall be a non-static member function.

I think we should apply the same wording strategy for all others mentioned in [oper.over.general] p8. I.e. we apply changes such as:

A function call operator function is a function named operator()
-that is a member function with
+. A function call operator function shall be a member function.
+It may have
an arbitrary number of parameters.
It may have default arguments.

Or in short, instead of having a narrow definition and saying that stuff has to fall into that narrow definition, we have a broader definition and mandate stuff.

This is simpler and has no normative impact.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read [over.oper.general] p8 and [over.ass] p1, then inspect the operator-function clauses referenced there. Update the relevant wording so each named kind is self-contained, and verify the draft has no normative change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.