Opened 12 years ago
#4542 new Bugs
bind() should use boost::result_of
| Reported by: | anonymous | Owned by: | Peter Dimov |
|---|---|---|---|
| Milestone: | Boost 1.44.0 | Component: | bind |
| Version: | Boost 1.44.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
if at all possible boost::bind(F(),...) should use boost::result_of<F(...)> instead of directly accessing F::result_type.
this way functors whose result type depends on the argument types could be used in bind(), for example:
#include <boost/bind.hpp>
#include <boost/utility/result_of.hpp>
using namespace boost;
struct F{
template<typename Args>
struct result;
template<typename T>
T operator()(T const &t) const{ return t; }
};
template<typename T>
struct F::result<F(T const &)>{
typedef T type;
};
template<typename F>
void g(F const &f){
typename boost::result_of<F()>::type res=f();
}
int main(){
f(bind(F(),4)); //error. no result_type in F
}
Attachments (1)
Note:
See TracTickets
for help on using tickets.

PoC patch. only supports 2 arguments and specific bindings