The following code example is taken from the book
C++ Templates - The Complete Guide, 2nd Edition
by David Vandevoorde, Nicolai M. Josuttis, and Douglas Gregor,
Addison-Wesley, 2017
© Copyright David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor 2017
#include "../typelist/typelist.hpp"
template<typename T>
struct IsFunctionT : std::false_type { // primary template: no function
};
template<typename R, typename... Params>
struct IsFunctionT<R (Params...)> : std::true_type { // functions
using Type = R;
using ParamsT = Typelist<Params...>;
static constexpr bool variadic = false;
};
template<typename R, typename... Params>
struct IsFunctionT<R (Params..., ...)> : std::true_type { // variadic functions
using Type = R;
using ParamsT = Typelist<Params...>;
static constexpr bool variadic = true;
};