c++ - Template typedef error -


Anyone can explain why this code is error:

  error c2039 : 'Rt': is not a member of 'concrete'  

(at least when compiled with VS 2008 SP1)

  class Record {}; Template & lt; Class T & gt; Class table {public: typed type name T: RT zot; // & lt; & Lt; Error is here}; Class Concrete Tables: Public Table & lt; Concrete Tables & gt; {Public: Recorded RT; };  

What can be done to fix this. Thanks!

Update: Thank you for pointing the issue, and for all suggestions, this snippet was based on the code that was providing an extensibility point within an existing code base, And the primary design goal was reducing the required work (typing) to add new extensions using this mechanism.

A different 'Type Signs' style class really fits into the best solution, especially as I can wrap it in a C style macro if the styling police is not looking!

"post-text" itemprop = "text">

This is because the contractual class can not be present immediately, so the compiler T: RT still does not see me Actually not sure how the C ++ standard handles this type of repetition (I suspect it is undefined), but it does not work how you expect (and it's probably good, otherwise things are very much Will be more complicated - you can Please have a logical contradiction with - as a const bool false iff it is true).

Fixing

With typedefs, I think you can not expect additional than RT as template parameters, such as

  Template & lt; Class T, Class RT & gt; Class Room {Public: Type FIP Type Name RT Zot; }; Class Concrete Tables: Public Table & lt; Concrete Tables, Record & gt; {Public: Recorded RT; };  

If you do not insist on RT that the table & lt; Available as:> Zot , you can put it inside the nested structure

Template Square T & gt; Class table {public: straight s} typingfap typename RT zot; }; }; Class Concrete Tables: Public Table & lt; Concrete Tables & gt; {Public: Recorded RT; };

Or even the external properties straight

  template & lt; Class T & gt; Structure tabs & lt; T & gt; Template & lt; Class T & gt; Structure tablet and lieutenant; Table & lt; T & gt; & Gt; {Type Did you type name T: RT zot; };  

If you want only one kind of logic / return type method, then you can do this by templatizing this method, e.g.

  void f (typewriter T: RT *); // This template & lt; Square U & gt; Zero F (U *); // This will be  

All these addendums mean to delay the requirement of T: RT as late as possible, especially as long as the concrete table is a complete square.


Comments