[Boost-bugs] [Boost C++ Libraries] #4542: bind() should use boost::result_of

Subject: [Boost-bugs] [Boost C++ Libraries] #4542: bind() should use boost::result_of
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-08-14 20:25:38


#4542: bind() should use boost::result_of
--------------------------+-------------------------------------------------
 Reporter: anonymous | Owner: pdimov
     Type: Bugs | Status: new
Milestone: Boost 1.44.0 | Component: bind
  Version: Boost 1.44.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 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
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4542>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC