c++ - How to use "extern template" with a nested class which is used by a templated member in the same class? -


First of all, some references: I am trying to use pepple idols as the Herb Sutter presented it. This title will appear in the file:

  #include "pimpl_h.h" class widget {class impl; Pimpl & lt; Impl & gt; Meter; // ...};   

The implementation will look like this:

  #include "pimpl_impl.h" class widget :: impl ... {};   

I am trying to solve the problem, when using a technique, a class uses another pimple class for its own implementation. This includes "PIMPLIMPLH", so the compiler (in my case VC ++ 2013) is referred to as pimpl & lt; Impl & gt; For the knowledge of the concrete template of the other class is obtained and attempts to incorporate it, which certainly results in compilation errors, because the implementation of that class is not known.

To solve this, I used the new "external template" feature of C ++ 11 in the header:

  #include "pimpl_h.h" Square widget {class impl; Pimpl & lt; Impl & gt; Meter; // ...}; Extern template pimpl & lt; Widget :: impl & gt;   

It should be ensured that I only have immediate immediate in the compilation unit which provides the implementation of the widget :: impl leads to a real urgency It is compiled without a problem, but IntelliSense shows me an error:

  error: 'extern template' class' pimpl & lt; widget :: impl & gt;   

As a "external template" a class can not be used within the manifesto, I

  #include "pimpl_h.h" class widget {class implus; extortion template pimple & lt; impl & gt; pimpl & lt; impl & gt; meter; // ...};   < P> And I can not think in any other way. My question is:  

Is IntelliSense incorrect and is the compiler correct in accepting my code? Or is it just a coincidence that VC ++ compiles it Is it not valid C ++?

If my solution is not valid, C ++, which options do I have?

I think I I think the standard is standard in 14.7.2.11

If a unit is a subject of a clear immediate declaration and a clear immediate definition in the same translation unit, then the definition will follow the declaration .

Which probably refers to IntelliSense. And this is where I found that the error message says, "... can not follow clear immediately ...". Obviously, anywhere in a clear instant, a contained inside the class definition of widget So I think it's a bug inside IntelliSense. Within the same paragraph, the standard is called

An institution which is the subject of a pronounced immediate announcement and which is otherwise used in an underlying acceleration (14.7.1) Translation Unit The subject of a clear definition would be obvious - in some programs; Otherwise the program is not bad, there is no clinical requirement.

For which a specific order (potential) does not require immediate urgency and immediate announcement.

At this point I also realized that my solution is really redundancy for my basic problem. I