I know that there are many possible ways to detect if a class has a specific function but non of them really work for my exact case. My current implementation to check for t
Here is a solution with
#include
#include
struct A {
auto foo() { return 0; }
};
struct B {
auto bar() { return 0.0; }
};
struct C : public A {
auto bAr() { return 0.0; }
};
struct D : public C {
auto baR() { return 0.0; }
};
template
using HasFoo_t = decltype(std::declval().foo());
int main() {
std::cout << std::experimental::is_detected_v << std::endl;
std::cout << std::experimental::is_detected_v << std::endl;
std::cout << std::experimental::is_detected_v << std::endl;
std::cout << std::experimental::is_detected_v << std::endl;
}