From: David Abrahams (dave_at_[hidden])
Date: 2002-12-05 13:25:00
"David A. Greene" <greened_at_[hidden]> writes:
>> template <class T, class U, class V>
>> struct my_type_generator
>> typedef my_type<T,U,V> type;
>> lambda<my_type_generator> does it
Oops, I meant
> , unless of course your compiler
>> needs BOOST_MPL_AUX_LAMDA_SUPPORT. I don't think it's much of a
>> savings, though.
> Not for one class, no, but when we're talking several classes
> with several binding requirements, I think there's a significant
> savings to be had.
So do you feel you need an additional library feature?
> Plus your solution here doesn't bind T to a type. :)
Are you just pointing out my error?
>>>I thought lambda might do the trick, but apparently not:
>>>typedef my_type<int, mpl::_1, mpl::_2> my_type_generator;
>>>(This will be passed to an MPL algorithm so I didn't
>>>bother with lambda<>).
>>>This causes a static assertion in mpl::arg<2> where it
>>>sees a void type for V (I think).
>>>Is the problem that my_type doesn't contain a ::type
>> Maybe. What compiler are you using?
> g++ 3.2. The MPL paper and docs don't say anything about
> using placeholders or binders with classes that aren't
> metafunctions. How would the binders know what to typedef
> as apply::type?
I don't know... well, it could detect whether there was a ::type
member, and if it were not present, it could just give you the outer
class. I think that's a bit of a hack, though.
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk