Opened 12 years ago
Last modified 10 years ago
#4489 new Feature Requests
References to function object types
Reported by: | Christopher Schmidt | Owned by: | Daniel Walker |
---|---|---|---|
Milestone: | To Be Determined | Component: | result_of |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
The current implementation of boost::result_of doesn't permit Fn in boost::result_of<Fn(Args...)> to be a reference to a class type. I would like to see that changed. Allowing reference-qualified function object types would be in useful with c++11's explicit reference qualification of member functions (n3090 / 13.3.1/4), and this change would bring boost::result_of more in line with c++11's std::result_of, which does allow "reference[s] to function object type[s]" (n3090 / 20.7.6.6)
Change History (7)
comment:1 by , 12 years ago
Owner: | changed from | to
---|
comment:2 by , 12 years ago
comment:3 by , 10 years ago
Description: | modified (diff) |
---|
comment:4 by , 10 years ago
Owner: | changed from | to
---|
comment:5 by , 10 years ago
Boost's decltype-based result_of
already accepts references to function objects.
Users can explicitly enable decltype-based result_of
by defining BOOST_RESULT_OF_USE_DECLTYPE
.
Or, in the trunk code, it is automatically enabled when a compiler supports N3276 decltype (e.g. clang-3.1).
For example, on clang-3.1 with the following functor:
struct F { short operator()(int) & { return 0; } float operator()(int) && { return 0; } };
boost::result_of<F& (int)>::type
evaluates toshort
.boost::result_of<F&&(int)>::type
evaluates tofloat
.
Is this enough for you? Or, do you want this feature in tr1-style result_of
?
comment:6 by , 10 years ago
Milestone: | Boost 1.44.0 → To Be Determined |
---|
We could update the old TR1 protocol to handle references to function objects, but that would take some refactoring. It could be done at the same time as refactoring for #6731... But updating TR1 result_of is lower priority.
- Daniel Walker
comment:7 by , 10 years ago
Component: | utility → result_of |
---|
"The current implementation of boost::result_of permits Fn in boost::result_of<Fn(Args...)>"...
oh, there is a mistake in there. Of course I meant that the current implementation of boost::result_of does not permit Fn in boost::result_of<Fn(Args...)>"...