c++ - pimpl idiom and template class friend -


I'm trying to use pimpl idiom to hide some grungy template code, but I do not give the derived class of Access to Body Class Mandle Class I get a C2248 error from MSVC 9 SP1 Here's some code to duplicate the error:

  // // interface.hpp // Namespace Internal {template & lt; Class T & gt; Class specific_a; } Class interface {struct body; Body * pbody_; Interface (body * pbody); Template & lt; Class T & gt; Friend class internal :: specific_; Public: ~ interface (); Interface (console interface & amp; rhs); Bull Test () CONST; Create stable interface (boolean value); }; // // interface.cpp // struct interface :: body {virtual ~ body () {} Virtual Bull Test () const = 0; Virtual Interface :: Body * Clone () const = 0; }; Square true_struct {}; Square false_struct {}; Namespace Internal {template & lt; Class T & gt; Class specific_ people: public interface :: body {// C2248 public: specific_body} {} Virtual Bull Test () const; Virtual Interface :: Body * Clone () Const {Returns New Specific_ (); }}; Bool Specific_A & lt; True_struct & gt; :: test () const {returns correct; } Bool specific_body & lt; False_struct & gt; :: test () const {return false; }} Namespace Internal Interface :: Interface (body * pbody): pbody_ (pbody) {} Interface :: Interface (CONST Interface & rhs): pbody_ (rhs.pbody _-> Clone ()) { } Interface:: ~ interface () {delete pbody_; } Bool Interface :: test () const {returns pbody _- & gt; testing (); } Interface Interface :: Create (Boolean Values) {If (Value) {Return Interface (New Internal :: Specific_ Head & lt; true_struct & gt; ()); } Other {Return Interface (new internal :: specific_top 
  • false_struct & gt; ()); }} // // main.cpp // // #include "interface.hpp" // int _tmain (int argc, _TCHAR * argv []) {interface object (create interface :: true); If (object.test ()) {// blah} and {} return 0; }
  • Any help would be appreciated, I was trying to apply with the interface :: body and specific_one users I interface if this is not clear from my question.

    You need to add a template & lt; > In the clear start of the template test method

      template & lt; & Gt; // Add this line bool specific_ & lt; True_struct & gt; :: test () const {returns correct; }  

    Comments

    Popular posts from this blog

    asp.net - Javascript/DOM Why is does my form not support submit()? -

    sockets - Delphi: TTcpServer, connection reset when reading -

    javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -