Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-04-02 19:53:51


Giovanni Piero Deretta wrote:
>> Egg secretly has the feature.
>> See "egg/inlined.hpp".
>>
>
> Inline because it is practically the only way to get gcc to inline a
> function pointer :) ?

I didn't know it!

>> You expect something like this?:
>>
>> static_result_of<T_curry2(F)>::type c = BOOST_EGG_CURRY2({}); // static
>
> Can't you use boost::result_of here? (or return_of)

As I mentioned, result_of needs to know whether or not an argument
is lvalue or rvalue. result_of is standardized, so that
I don't like to violate the law.
Also, as Eric stated in Proto doc, result_of compiles slow.

It seems a good idea to introduce static_result_of(Do you know a better name?).
All the macros can be moved to static_result_of document section, and
all the result_of_xxx<> can be removed.

> Also, do you have a plan for allowing complex statically initialized
> expressions in header files
> without ODR violations?

Though BOOST_EGG_CONST does nothing for now,
it has the potential to work around the ODR violation.
But I hesitate to say "Any function definition requires a macro!".
Anyway, I want to follow the Boost.Proto way.

>> boost::result_of<T_curry2(F const &)>::type c = curry2(f); // dynamic
>
> or egg::return_of if you want recursive evaluation.

I'm not sure return_of is portable under msvc.
That trivial example( http://tinyurl.com/yuumdv ) actually doesn't compile. :-(

>> stateless_result_of<T_curry2(F)>::type c = BOOST_EGG_STATELESS(); // for stateless one.
>
> Why not:
>
> expression<T_curry2(F)> c = { /*just this please :) */ }; // note
> the missing ::type

It seems impossible to remove ::type,
because `expression` can't use inheritance so that it can be a POD.

Well, 8.5.1 -14- states that "When an aggregate with static storage duration...".
I think that if "an aggregate" means also "subaggregate", `{}` is not enough.
Anyway, I should wait for Eric's answer.
BTW,
   expression<T_curry2(F)>::type c = {{}};
is feasible.

Regards,

-- 
Shunsuke Sogame

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk