I'm confused about why one of these functions gives a hard error, and the other does not:
#include <utility>
template <typename ...Args>
auto ffExists1()
-> decltype(ff(std::declval<Args>()...)); // Attempts to see
// whether you can call ff (which is not defined or declared)
// with arguments of type Args... This works fine.
template <typename ...Args>
auto ffExists2() -> decltype(&ff); // Gives me a hard error : ff not defined
Why is that?
Also, how do I make ffExists2 work? Taking a pointer to a function would let me determine the exact signature of ff while ffExists1 only finds out if I can call ff with arguments of type Args....
EDIT: here is a version where ffExists2 depends on a template, causing the same result:
#include <utility>
template <typename ...Args>
auto ffExists() -> decltype(ff(std::declval<Args>()...)); //Fine
template <typename ... Args>
void SomeHelperFunc(auto (*) (Args...));
template <typename ...Args>
auto ffExists2() -> decltype(SomeHelperFunc<Args...>(&ff)); // Hard Error