I have a couple of template classes
template < class Cost >
class Transition {
public:
virtual Cost getCost() = 0;
};
template < class Transition
One way is to use the return type of getCost()
(but it may give you an uglier error messgae if TransactionCl()
doesn't have such a public member function).
std::is_base_of< Transition< decltype(TransitionCl().getCost()) >, TransitionCl >::value,
Another option is adding a typedef
to the base class:
template < class Cost >
class Transition {
public:
typedef Cost Cost_Type; // <-------
virtual Cost getCost() = 0;
};
Then you can remove State
's typename Cost
parameter and use the typedef
instead in your static assert...
std::is_base_of< Transition< typename TransitionCl::Cost_Type >, TransitionCl >::value,