Search code examples
c++boost-fusionenable-if

enable_if boost::fusion callable


Is there a way to use enable_if specifically for boost::fusion callable objects?

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<> ?
}

Here F is a fusion "fused function" can take an arbitrary Sequence as a parameter


Solution

  • I tried something similar, until now without success. My first successful attempt was to create for a different number of template parameters different templates via boost praeprocessor makros. In your examples would this be

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

    Since I had to use VC10 I could not use a solution with variadic templates. Perhaps this helps you further, even the question is rather old.