|
Boost Users : |
From: Edd Dawson (edd_at_[hidden])
Date: 2006-08-24 15:43:14
David Abrahams wrote:
>>>> struct call_f
>>>> {
>>>> template <class Wrapper>
>>>> void operator()(Wrapper)
>>> Sorry, it's missing a "const" right here--^^^^
>>>> {
>>>> f<typename Wrapper::type>();
>>>> }
>>>> };
>>>>
>>>> mpl::for_each<my_vec, mpl::identity<_> >(call_f());
>> I didn't find this in the docs. Is it meant to be there?
>
> The specific answer to your specific problem? No. Oh yeah, for_each
> wasn't documented in 1.33.1... and apparently it isn't documented in
> the CVS head either (still? Aleksey?)
Yep, I was referring to mpl::for_each in general.
>> Unfortunately, that didn't quite work for me, anyway. A requirement
>> of for_each (according to my MSVC 8 diagnostics) is that each type
>> in the sequence must be default constructible.
>
> In the case above, only mpl::identity<T> needs to be
> default-constructible for each type in the list... or that was my
> intention Ach! My mistake...
>
> template <class T>
> struct make_identity { typedef mpl::identity<T> type; };
>
> mpl::for_each<my_vec, make_identity<_> >(call_f());
>
> should work.
Like a charm! Many thanks!
Kind Regards,
Edd
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net