c++ - Workarounds for the forward-declared class enumeration problem? -


I am maintaining a large code base and using a combination of further announcements and PIMPL phrases so that time Reduce the compilation and reduce the reliance (and it actually works well),

I have problems with those sections that contain public enumeration, these enumeration should not be forwarded. So, to include class headers No option has been left. For example:

  // Foo.h square fu {public: anonym type {TYPE_A, TYPE_B,}; ...}; // Bar.h #include "Foo.h" // Foo :: type for class bar {public: zero some function (Foo :: type type); ...};  

So, I'm looking for ways to avoid it and only think about the following:

The numbers of the class are different Type namespace

  // FooTypes.h name spaces FooTypes {enum type {TYPE_A, TYPE_B,}; } // Bar.h # included "FooTypes.h" class bar {public: zero some functions (FooTypes :: type type); ...};  

Use int instead of computation

  // Bar.h class bar {public: some functions (int type ); ...};  

What am I missing? How to get other people around this limit (not being able to forward declared declared numbers).

In its own type:

  struct FooEnum {enum type {TYPE_A, TYPE_B,}; };  

Then you can use both foo and bar FooEnum :: Type and Bar.h is not required to include Foo.h .


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -