Ian McCulloch wrote:
Peter Dimov wrote:
[...]
I don't get it: can't you detect whether nested::result
::type exists? As long as the primary template of nested::result is defined as an empty struct this should work fine(?).
No, consider what happens when 'nested' is int (*) (), for example.
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!
The current C++ compilers can't backtrack on an error, so once decltype(expr) triggers a complicated chain of events potentially involving multiple implicit template instantiations, there is no way back. Or so I hear. :-)