c++ - Opaque object for template in another namespace -


I know how to do an opaque object in C ++ as the following:

 < Code> // my_class HPP class opaque_object; Square my_class {my_class (); ~ My_class (); Opaque_object * m_opaque_object; }; // my_class.cpp # include & lt; My_class.hpp & gt; Class opaque_object {// ...}; My_class :: my_class () {m_opaque_object = new opaque_object (); } My_class :: ~ my_class () {delete m_opaque_object; }  

How to do this now when the opaque object is an existing class template in a different namespace, without this the header file of this one is included. The following code is not good, it is just to clarify my problem.

  // my_class.hpp class third :: party :: library :: opaque_object & lt; Third :: Party :: Library :: templated_class> Square my_class {my_class (); ~ My_class (); Third :: Party :: Library :: opaque_object & LT; Third :: Party :: Library :: templated_class & gt; * M_opaque_object; }; // my_class.cpp # include & lt; My_class.hpp & gt; # Include & lt; Third / party / library / follow_bose HP & gt; # Include & lt; Third / party / library / template_close. HP & gt; Typedef Third :: Party :: Library :: opaque_object & lt; Third :: Party :: Library :: templated_class & gt; Opaque_object; My_class :: my_class () {m_opaque_object = new opaque_object (); } My_class :: ~ my_class () {delete m_opaque_object; }  

The actual class of my source code is templated even more than this example (4 arguments of the template with some of them that are themselves templated classes).

My_class.hpp is used quite everywhere everywhere in my project, it takes a lot of time in normal compilation (only 5sec to include my_class.hpp for each CPP file) so i opaque_object.hpp , Would like to save with template_class.hpp ... My_class.hpp in

How can this be done? Welcome to any comments or ideas. Thank you in advance for your time.

Why not make it template-template parameter (do not know if you need more parameters there :)

  template & lt; Typename t, template & lt; Class & gt; TypeName opaque> class my_class {... opaque & lt; T & gt; * Opaque_; };  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -