cplusplus / cplusplus/draft

[concept.regularinvocable] Adding examples for regular_invocable would be helpful

Open
#3,479 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It would be very helpful to having examples on what is allowed in regular_invocable.

Here is a draft:

int g;
int f1(int* p, int& r) { // regular_invocable
    ++g;
    ++*p;
    // r is not modified
    return 0;
}
int f2(int* p, int& r) { // not regular_invocable
    ++r;
    return 0;
}
struct F {
    mutable int m;
    int* p;
    int& r;
    int operator()() const { // regular_invocable
        ++m;
        ++*p;
        ++r;
        return 0;
    }
};

Please note that I do not understand regular_invocable well (so I request to add examples ;) ) and the regular_invocable/non-regular_invocable distinction may be incorrest.

This is related to GB206 (cplusplus/nbballot#204).

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

Start with the regular_invocable concept wording in the draft and the related GB206 discussion in cplusplus/nbballot#204. Check whether the proposed f1, f2, and F examples correctly illustrate the distinction, then add accurate examples to the relevant draft section; done means the examples clearly match the normative wording.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.