I would like too know the rationale behind of
and o->f
being prvalue
s, where o
is an object, and f
is a non-static member function.
EDIT 1
My point is that putting it into a prvalue
category seems to be tantamount to an ad hog decision as even though it is not an lvalue
in its fullest, it's not yet a complete rvalue
also.
of
OR o->f
THAT IS TAKEN And that is odd -- consider point 1) above, only modifiable lvalue
s are assignable by definition, so lvalue
properties are not violated by this "non-assignability". But in 3), all prvalues
shall be able to init rvalue references, but a member function can not, presumably.
EDIT 2
I am particularly interested in something like a justification paper from committee people or something like this, showing why it is made this way.
I may be terribly wrong, but I may imagine a hypothetical set of rules that would allow of
to follow all the behaviors of lvalue
. We necessarily need a binding object only for the sake of function call, and technically there is still one definition of the member function in the programm. That seems to be a bit whimsical for me that we cannot trat pointer to non-static member functions exactly like regular function pointers except were call is attempted, where we should provide an argument for a implicit object parameter
.
just my guess. In expression of()
, f
is not really a subobject of o
, it effectively bind o
and f
together which can then be called.
which does something like
//-------------o.f----------------()
std::bind_front(&decltype(o)::f,o)()
except it preserve overloads and (thus) cannot be used in other way (like store in variable).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.