So I have the following two classes:
template < class Cost >
class Transformation {
public:
virtual Cost getCost() = 0;
};
template < class Trans
Does this suit your need?
template < class Cost >
class Transformation {
public:
typedef Cost TransformationCost;
virtual Cost getCost() = 0;
};
template < class TransfCl, class Cost = typename TransfCl::TransformationCost>
class State {
static_assert(
std::is_base_of< Transformation< Cost >, TransfCl >::value,
"TransfCl class in State must be derived from Transformation< Cost >"
);
protected:
State(){}
public:
virtual void apply( const TransfCl& ) = 0;
};
class TransfImpl : public Transformation< int >{
public:
int getCost(){ return 0; }
};
class StateImpl : public State< TransfImpl >{
public:
StateImpl(){}
void apply( const TransfImpl & ){}
};
ADDED: Live Demo