$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Vyacheslav E. Andrejev (vandrejev_at_[hidden])
Date: 2005-01-27 03:38:48
Hello All!
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<Type1, Type2, Type3, Type4> types;
and following transformation:
typedef boost::mpl::transform<
    types
  , boost::is_convertible<Type3, boost::mpl::_1>
  >::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<ConversionType, boost::mpl::_1>
      >::type type;
  };
};
But it seems more like workaround rather than solution. Can it be done in more convenient and short manner by means of all mpl machinery like mpl::lambda, mpl::bind, placeholders, etc... ?
-- Vyacheslav E. Andrejev System Architect, Excelsior, LLC