Paragraph 20.8.9.1.3 of the C++11 Standard defines the effects of calling std::bind()
in terms of the INVOKE()
pseudo-function this way:
Returns: A forwarding call wrapper
g
with a weak result type (20.8.2). The effect ofg(u1, u2, ..., uM)
shall beINVOKE (fd, std::forward<V1>(v1), std::forward<V2>(v2), ..., std::forward<VN>(vN), result_of<FD cv & (V1, V2, ..., VN)>::type)
Notice that the call to std::forward<>
will always return a reference type, be it an lvalue reference or an rvalue reference. Per Paragraphs 20.2.3/1-2, in fact:
template <class T> constexpr T&& forward(typename remove_reference<T>::type& t) noexcept;
template <class T> constexpr T&& forward(typename remove_reference<T>::type&& t) noexcept;
Returns:
static_cast<T&&>(t)
Therefore, the INVOKE
pseudo-function (watch out: not the bind()
function!) will be invoked with references here, and this is supported by the definition you quoted.
I believe the Standard itself never makes use of the INVOKE()
pseudo-function (which is just some internal formalism) with objects (not references to object) of a type derived from T
.
However, this doesn't meant that you cannot invoke std::bind()
or other functions whose definition is in turn given in terms of INVOKE()
with an object (not a reference to an object) of a type derived from T
.