|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-04-02 17:59:48
Giovanni Piero Deretta wrote:
> Hum, if you want to have guaranteed static initialization, you need to
> statically know the function pointer value:
>
> template<typename Sig, Sig * p>
> static_function_ptr {
> typedef typename result_of_sig<Sig>::type result_type;
>
> template<typename Args...>
> result_type operator()(Args.... args) {
> return p(args);
> }
> };
>
> Substitute the pseudo-variadic syntax with proper preprocessor magic :).
Egg secretly has the feature.
See "egg/inlined.hpp".
>> I'm really afraid that those macros may keep users away from the library.
>>
>
> Hey, maybe it is just me, maybe others won't have any problems with
> them. I just find the macro based initialization ugly and unnecessary
> complex.
You expect something like this?:
static_result_of<T_curry2(F)>::type c = BOOST_EGG_CURRY2({}); // static
boost::result_of<T_curry2(F const &)>::type c = curry2(f); // dynamic
stateless_result_of<T_curry2(F)>::type c = BOOST_EGG_STATELESS(); // for stateless one.
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