Boost logo

Boost Users :

Subject: [Boost-users] fusion Transformation function passed to transform
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-02-25 11:59:27


Hello,

The transformation function to pass to fusion::transform() function and metafunction are hard to get right, in particular the embedded inner result struct because of the fact that the template argument of result is a "function signature"

There is only the 1 simple example in libs/fusion/doc/html/fusion/algorithm/transformation/metafunctions/transform.html

I for one would love to see another example where the fusion vector has different types, and where the result of transformation function depends on each type of the sequence transform is applied on.

In the meantime, I am writing something like this:

struct extract_rule {

  template <typename Signature> struct result; //// primary template

  template <typename Holder> struct result< extract_rule(const Holder) > { //// is this always a specialization of the primary?
      typedef .... type;
  };

  template <typename Holder>
  typename result<extract_rule(const Holder)>::type
  operator()( const Holder& h ) const
  {
    ....
  }
};

Does this look right?

regards,


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