Vyacheslav E. Andrejev writes:
I want to parametrize mpl::transform to form a new metafunction. But I have confused with mpl syntax and notations. Imagine, I have following vector
typedef boost::mpl::vector
types; and following transformation:
typedef boost::mpl::transform< types , boost::is_convertible
::type result;
The result of the tansformation is a bool vector that indicates whether Type3 is convertible to any of type from types vector. Now I want to form metafunction that will construct such array not from Type3, but from its argument. Of course, I may use straightforward method:
struct WhoConverted { template <typename ConversionType> struct apply { typedef typename boost::mpl::transform< types , boost::is_convertible
>::type type; }; };
Or
template< typename T > struct WhoConverted
: boost::mpl::transform<
types
, boost::is_convertible
But it seems more like workaround rather than solution.
It's inconvenient to have to write (and name) an auxiliary template that has no other uses, yes.
Can it be done in more convenient and short manner by means of all mpl machinery like mpl::lambda, mpl::bind, placeholders, etc... ?
At the moment, the above is the best you can have. I'm considering implementing lambda scoping along the lines of http://article.gmane.org/gmane.comp.lib.boost.devel/116000 for the next release. HTH and sorry for the late reply, -- Aleksey Gurtovoy MetaCommunications Engineering