How to enforce template parameter class to derive from super with an anonymous template parameter

前端 未结 2 545
离开以前
离开以前 2021-01-27 06:27

I have a couple of template classes

template < class Cost >
class Transition {
  public:
    virtual Cost getCost() = 0;
};

template < class Transition         


        
2条回答
  •  臣服心动
    2021-01-27 07:12

    From what I understood from your question, here is a quick solution that I have:

    template < class Cost >
    class Transition {
      public:
        virtual Cost getCost() = 0;
    };
    
    template 
    class Der : public Transition
    {
    public:
      T getCost() override {
      }
    };
    
    template < class Transition >
    class State;
    
    template