0

I'm having trouble compiling the following (I'm new at fusion). In particular, I'm not sure where "_" (in is_same) comes from? From boost::lambda? Boost::mpl? What include do I need for this to compile?

template <typename T>
struct check
{ 
  const T& value;

  check(const T& v) : value(v) {}

  template <typename X>
  bool operator()(const fusion::pair<X,T>& data) const
  {
    return data.second == value;
  }
};

template <typename T1, typename T2, typename P>
bool new_match(const P& p, const T2& values)
{
  fusion::for_each(fusion::filter_if<boost::is_same<_, T2> >(p), check(values));
  return true; // not finished, just trying to compile
}

Thanks!

Luc Touraille
  • 79,925
  • 15
  • 92
  • 137
Frank
  • 4,341
  • 8
  • 41
  • 57

1 Answers1

3

Yes, that indeed is meant to be boost::mpl::_, as demonstrated in the fusion::filter_if documentation, so you should only need #include <boost/mpl/placeholders.hpp> and a qualification or using declaration to bring _ into scope.

ildjarn
  • 62,044
  • 9
  • 127
  • 211
  • I read the doc only up to point, and saw only the example in the introduction... I didn't check the ref for filter_if :-( Thanks for the pointer! :-) – Frank Jun 22 '11 at 22:36
  • @Frank : No worries. :-] To be fair, the Fusion documentation definitely assumes deep prior knowledge of MPL and often conflates symbols from both libraries without much explanation. – ildjarn Jun 22 '11 at 22:58