I would like to detect cycles in class dependency by trying to check if given function was create.
template < class PA, class CH>
void dependsOn( PA* , CH* )
{
#pragma message("COMPILE: " __FUNCSIG__)
static_assert(!std::is_function< decltype(dependsOn<PA, CH>) >::value,"Cycle in dependencies");
}
Each class will call that template function class B();
class A{
B b;
public:
A(){ dependsOn(this, &b);}
}
However this check is not working as is_function returns always true, no matter if such template function was created or not.
Aucun commentaire:
Enregistrer un commentaire