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

2435. reference_wrapper::operator()'s Remark should be deleted

Section: 22.10.6.5 [refwrap.invoke] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2014-10-01 Last modified: 2017-07-30

Priority: 4

View all other issues in [refwrap.invoke].

View all issues with C++17 status.

Discussion:

22.10.6.5 [refwrap.invoke]/2 is no longer useful. (It was originally TR1 2.1.2.4 [tr.util.refwrp.invoke]/2.) First, we already have the As If Rule (6.9.1 [intro.execution]/1) and the STL Implementers Can Be Sneaky Rule (16.4.6.5 [member.functions]). Second, with variadic templates and other C++11/14 tech, this can be implemented exactly as depicted.

[2015-05, Lenexa]

DK: I don't see a defect here
STL: the issue is that the standard is overly verbose, we don't need this sentence. It's redundant.
MC: does anyone think this paragraph has value?
JW: it has negative value. reading it makes me wonder if there's some reason I would want to provide a set of overloaded functions, maybe there's some problem with doing it the obvious way that I'm not clever enough to see.
Move to Ready status: 8 in favor, none against.

Proposed resolution:

This wording is relative to N3936.

  1. Change 22.10.6.5 [refwrap.invoke] p2 as depicted:

    template <class... ArgTypes>
      result_of_t<T&(ArgTypes&&...)>
        operator()(ArgTypes&&... args) const;
    

    -1- Returns: INVOKE(get(), std::forward<ArgTypes>(args)...). (20.9.2)

    -2- Remark: operator() is described for exposition only. Implementations are not required to provide an actual reference_wrapper::operator(). Implementations are permitted to support reference_wrapper function invocation through multiple overloaded operators or through other means.