$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] fusion::result_of::invoke_function_object and	references
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-26 18:02:38
AMDG
Mike Tegtmeyer wrote:
> I have another question regarding compilation failures with fusion. If 
> this has been discussed before, can someone please point me to the 
> right location. If not...
>
> Is there some reason the application of 
> result_of::invoke_function_object fails to compile for sequence 
> argument references?
>
> ie: result_of::invoke_function_object<doit, fusion::vector<int>&>::type
>
> Digging a little, it seems that the failure is due to the size<> 
> operator doesn't work with reference types (or is expecting the 
> reference to be stripped prior to this point). I understand that to 
> avoid unnecessary copies, tiers are typically used but in the case 
> where chains of invoke_function_object would like to be strung 
> together where there is an assignment or construction from the actual 
> return value to a variable declared as the type obtained from 
> result_of (in a fold for example), it seems that the vector copy is 
> unavoidable (at least in my reading) unless the argument vector is a 
> const reference.
>
> Is this an oversight or am I missing something?
>
> Basically I am trying to string together N function objects in the 
> sequence where the ith object gets called with the result of the i-1th 
> object (where each has a different argument list) using fold and I am 
> running into extraneous copies of the return value. I can post a full 
> example if needed.
>
> Thanks in advance,
> Mike
>
> error message:
> /opt/local/include/boost/fusion/sequence/intrinsic/size.hpp:28: error: 
> const boost::fusion::vector<int, boost::fusion::void_, 
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, 
> boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, 
> boost::fusion::void_, boost::fusion::void_>& is not a class, struct, 
> or union type
Strip the references of when you call result_of::invoke_function_object.
You don't need to actually pass anything by value.  This is just the return
type calculation.
In Christ,
Steven Watanabe