
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression: boost::result_of< F(T1 ...TN) >::type Unfortunately, constructor does not support result_of. Its implementation contains the following piece of code: template <class U> struct sig { typedef T type; }; This happens to be exactly what's necessary for constructor to support result_of, but sig would have to be renamed to result. I guess I do not really have a question here but rather a request to make constructor compatible with result_of. There seems to be no reason not to do it, and I could not figure out a much nicer way to construct objects with fusion sequences than combining lambda's constructor and fusion's fused. It comes so close, but if only sig was result... Cheers, Marcin [1] http://www.boost.org/doc/libs/1_42_0/doc/html/lambda/le_in_details.html#lamb... [2] http://www.boost.org/doc/libs/1_42_0/libs/fusion/doc/html/fusion/functional/...

AMDG Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of. Its implementation contains the following piece of code:
template <class U> struct sig { typedef T type; };
This happens to be exactly what's necessary for constructor to support result_of, but sig would have to be renamed to result.
I guess I do not really have a question here but rather a request to make constructor compatible with result_of. There seems to be no reason not to do it, and I could not figure out a much nicer way to construct objects with fusion sequences than combining lambda's constructor and fusion's fused. It comes so close, but if only sig was result...
The problem is that Lambda came before result_of. See also https://svn.boost.org/trac/boost/ticket/864 In Christ, Steven Watanabe

Steven,
Thanks for pointing that out. I tried a quick search for the problem,
but I used wrong keywords apparently.
Cheers,
-m
On Fri, Feb 26, 2010 at 10:36, Steven Watanabe
AMDG
Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of. Its implementation contains the following piece of code:
template <class U> struct sig { typedef T type; };
This happens to be exactly what's necessary for constructor to support result_of, but sig would have to be renamed to result.
I guess I do not really have a question here but rather a request to make constructor compatible with result_of. There seems to be no reason not to do it, and I could not figure out a much nicer way to construct objects with fusion sequences than combining lambda's constructor and fusion's fused. It comes so close, but if only sig was result...
The problem is that Lambda came before result_of. See also https://svn.boost.org/trac/boost/ticket/864
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)

Thanks!
On Fri, Feb 26, 2010 at 11:07, Mathias Gaunard
Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

AMDG Mathias Gaunard wrote:
Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
Phoenix v2 uses it's own result protocol which is not compatible with result_of. In Christ, Steven Watanabe

On 2/27/2010 12:57 AM, Steven Watanabe wrote:
AMDG
Mathias Gaunard wrote:
Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
Phoenix v2 uses it's own result protocol which is not compatible with result_of.
No, Phoenix v2 lambda(actor) function objects supports the result_of protocol. fusion::function does not, due to backward compatibility. This backward compatibility will be broken when we switch to V3, or if possible both will be supported. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon

I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN) >::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
Actually, it seems that Phoeinx's construct does not do the same thing as lambda's constructor. Using lambda, you can write: constructor<T>() c; c(arg1, ..., argn); With Phoenix, you need to give arguments ahead of time: construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN); That's not exactly the same. Lambda works out very nicely in a situation where it is not possible to say how many arguments will there be until they are collected. -m

On 2/27/2010 1:30 AM, Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN)>::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
Actually, it seems that Phoeinx's construct does not do the same thing as lambda's constructor. Using lambda, you can write:
constructor<T>() c; c(arg1, ..., argn);
With Phoenix, you need to give arguments ahead of time:
construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
That's not exactly the same. Lambda works out very nicely in a situation where it is not possible to say how many arguments will there be until they are collected.
That (constructor) is very easy to add as a phoenix lazy function (just a few lines of code). Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon

Joel,
On Fri, Feb 26, 2010 at 21:46, Joel de Guzman
On 2/27/2010 1:30 AM, Marcin Zalewski wrote:
I am trying to use lambda's constructor [1] with fusion's fused [2]. Fused requires that the function object passed to it has a following valid expression:
boost::result_of< F(T1 ...TN)>::type
Unfortunately, constructor does not support result_of.
Use Phoenix instead of Lambda, and problem solved ;)
Actually, it seems that Phoeinx's construct does not do the same thing as lambda's constructor. Using lambda, you can write:
constructor<T>() c; c(arg1, ..., argn);
With Phoenix, you need to give arguments ahead of time:
construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
That's not exactly the same. Lambda works out very nicely in a situation where it is not possible to say how many arguments will there be until they are collected.
That (constructor) is very easy to add as a phoenix lazy function (just a few lines of code).
I think I understand what do you mean about turning constructor into a lazy function, but, I think, I had something else in mind. The lambda constructor object does not need to know ahead of time how many arguments will it take. It basically takes a type parameter, and then, *at the time of call*, it calls the appropriate constructor. This is useful when, in a given context, you do not know which constructor will be called. Can one use phoenix's constructor in such unplanned way? -m
participants (4)
-
Joel de Guzman
-
Marcin Zalewski
-
Mathias Gaunard
-
Steven Watanabe