Apply the first valid function of a set of N functions
This previous answer shows how to apply function based on the validity of a call: here . However, it applies to two functions. I was wondering if the concept could be generalized to N functions using smart template programming tricks, in C++14. The problem is the following: template <std::size_t N, class... X> /* [Return type] */ apply_on_validity(X&&... x) { // Tricks here } // The function would be equivalent to a hypothetical // template <std::size_t N, class... F, class... Args> // [Return type] apply_on_validity(F&&... f, Args&&... args) // where N = sizeof...(F) is the number of