开发者

boost fusion question

I'm having trouble compiling the following (I'm new at fusion). In particular, I'm not su开发者_开发百科re 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜