Peter Dimov wrote:
Ian McCulloch wrote:
Thanks Peter, I think I understand how it works now. Unfortunately, the lack of SFINAE is a real showstopper for me. I want to write functions like
template <typename T> typename result_of
::type operator-(T const& x) { return negate()(x); } but the lack of SFINAE here makes boost::result_of essentially useless for this.
Yes, I've encountered this too. The problem is in the unconditional instantiation of the nested ::result<>. Since we don't have a reliable way to detect a nested template yet (requires core language change), this can't be fixed except by removing the ::result<> logic altogether and relying on specializations instead, as in the example I gave.
I don't get it: can't you detect whether nested::result
This won't help us in general, though. result_of is not supposed to support SFINAE, because it may be implemented with __typeof or __decltype internally.
Do you mean that a substitution failure in a typeof or decltype expression *is* an error? Ouch! Cheers, Ian