c++ - Template class requires template arguments? -


Sorry, I did not know how to write a great headline for this question, feel free to edit.

I have many classes that have the same role , which means that they all apply the same interface (set of methods). Consider that they all get from the same table class (even if this is not a case in a minor example, this is not the issue of this question). and U , and one of the previous sections

code> A without template logic . Internally, this new class A & lt; T & gt; and a & lt; U & gt; . Is this possible? C + + 11 replies are welcome, if necessary, do not hesitate to add the tag.

The example that fails is:

  #include & lt; Iostream & gt; // ------------------------------------------------ ------------------------ straight eng_tag {}; Struct fr_tag {}; Struct sp_tag {}; // First implementation of the "Talk Interface" template & lt; Class T = eng_tag> struct e {zero point () {std :: cout & lt; & Lt; "Hello \ n"; }}; Template & lt; & Gt; Structure A & lt; fr_tag & gt; {Zero point () {std :: cout & lt; & Lt; "Saluting \ n"; }}; Template & lt; & Gt; Structure A & lt; sp_tag & gt; {Zero point () {std :: cout & lt; & Lt; "Hail \ n"; }}; // Second Implementation Template & lt; Class T = eng_tag> struct b {zero point () {std :: cout & lt; & Lt; "By \ n"; }}; Template & lt; & Gt; Structure B & lt; fr_tag & gt; {void talk () {std :: cout & lt; & Lt; "A Bientot \ n"; }}; Template & lt; & Gt; Structure B & lt; Sp_tag & gt; {Zero point () {std :: cout & lt; & Lt; "Adios \ n"; }}; // e.t.c... // ------------------------------------------ ------------------------------ Templates & lt; Class T, Class U, Class I = A & gt; Structure Cover (I  A () {Return  <>> <> I  U <2 () {Return  <> (Return to I & lt; U & gt; );}}; // ------------------------------------------- ----- ------------------------ int main () {wrapper & lt; fr_tag, sp_tag, b & gt; w; w .one () thing (); w.two () thing ().;}    

< p> A is not a type if you do not want