Stjepan Rajko a écrit :
> What is your use case? I found this sort of thing useful for finding
> out whether result_of would work for a specific set of arguments. Is your
> metafunction intended for testing whether result_of would work for _some_
> (whichever) set of arguments? (it doesn't quite do that
> because it doesn't check that result has a nested type typedef).

I was trying to use it as a simple traits to see if a given type fullfilled the result_of protocol
whatever the arguments used. It works ok for the result_type variant but now I see it's still incomplete. The problem is that I can't see, for an arbitrary result structure, how I can see if it actually has at least one overload that has a proper nested type typedef.

Typical use is :

For F a given type,  support_result_of_protocol<F>::type evaluates as a compile time boolean indicating if either F has a nested result structure or result_type typedef. It doesn't make any assumptions on wether or nor result is correcly implemented.

As for testing if a particuliar set of arguments produces a valid result_of, one can easily do :

template< class F
        , template<class> class T = boost::result_of<F>::type
        > struct valid_impl
{
  typedef void type;
};

template<class F, class EnableIf = void>
struct produce_valid_result_of : boost::false_type {};

template<class F>
struct produce_valid_result_of<F,typename valid_impl<F>::type> : boost::true_type {};

or did I miss something in your question ?