[Boost-bugs] [Boost C++ Libraries] #4582: fold() doesn't work with function objects that don't support perfect forwarding

Subject: [Boost-bugs] [Boost C++ Libraries] #4582: fold() doesn't work with function objects that don't support perfect forwarding
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-08-21 18:52:29


#4582: fold() doesn't work with function objects that don't support perfect
forwarding
-------------------------------------+--------------------------------------
 Reporter: anonymous | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: fusion
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 the unrolled specializations of fold() are implemented as

 {{{
 f(f(f(state,a),b),c)
 }}}

 if f is a function object that doesn't support perfect forwarding, but
 only accepts "T &" arguments, this doesn't work.

 this is e.g. the case for all phoenix::bind() results:

 {{{
 int f(int,int,int){ return 0; }

 int main(){
     fusion::vector<int,int> vec;
     fusion::fold(vec,0,phoenix::bind(&f,_1,_2,3)); //error
 }

 }}}

 AFAIK a bind() cannot support perfect forwarding and at the same time
 support the result_of protocol, not even for up to 2 arguments as
 Boost.Bind does.

 attached is a patch that changes that.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4582>
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