2013-02-27 76 views
0

有没有一种方法可以专门为boost :: fusion可调用对象使用enable_if?enable_if boost :: fusion callable

template<typename F> 
void do_something(F f, enable_if< is_fusion_callable_object<F> >::type * = 0) 
{ 
    // how to define the "is_fusion_callable_object<> ? 
} 

这里F是一个融合“的融合功能”可以采取任意序列作为参数

回答

1

我想类似的东西,到现在为止都没有成功。 我第一次成功的尝试是通过boost praeprocessor makros为不同数量的模板参数创建不同的模板。在你的例子中,这将是

template <typename P1, ......> 
do_something(boost::fusion::vector<P1, ....> const& v) 

因为我不得不使用VC10我不能使用可变参数模板的解决方案。也许这可以进一步帮助你,即使这个问题是相当古老的。