Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // example_fwd.hpp
- // Here necessary to forward declare the template class,
- // you don't want people to declare them in case you wish to add
- // another template symbol (with a default) later on
- class MyClass;
- template <class T> class MyClassT;
- // example.hpp
- #include "project/example_fwd.hpp"
- // Those can't really be skipped
- #include <string>
- #include <vector>
- #include "project/pimpl.hpp"
- // Those can be forward declared easily
- #include "project/foo_fwd.hpp"
- namespace project { class Bar; }
- namespace project
- {
- class MyClass
- {
- public:
- struct Color // Limiting scope of enum
- {
- enum type { Red, Orange, Green };
- };
- typedef Color::type Color_t;
- public:
- MyClass(); // because of pimpl, I need to define the constructor
- private:
- struct Impl;
- pimpl<Impl> mImpl; // I won't describe pimpl here :p
- };
- template <class T> class MyClassT: public MyClass {};
- } // namespace project
- // example_impl.hpp (not visible to clients)
- #include "project/example.hpp"
- #include "project/bar.hpp"
- template <class T> void check(MyClass<T> const& c) { }
- // example.cpp
- #include "example_impl.hpp"
- // MyClass definition
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement