Forward declaration - how far to go?

Started by
11 comments, last by Juliean 10 years, 11 months ago

Okay, I see, since I'm not using that much third-party libs (just directx and some standard-libaries, of course), I'm not going through the trouble right now.

But just another question, since I'm designing my "engine" with use by other users in mind, and seperate from the game I'm developing, how would I go about that? Obviously most third-party libs I know at least offer the convenience of being able to do things like:


#include "Gui/Toolbar.h"

	//create game widget button
	gui::ToolButton* pCreate = pToolbar->AddButton(L"Frame/New.png");
	pCreate->SigReleased.Connect(this, &SceneToolbarCtrl::OnCreateGameObject);

Now with the new forward declaration method, I'd need to also include "Gui/ToolButton.h". Thats a little inconvenient, which doesn't matter for the lib itself, but should I really expect the user to include everything in advance of his compile time, or is there some prefered solution for this?

Advertisement
One option is to create helper headers for each subsystem of your library. In your case, you could have a gui.h header that just includes all the other headers that have items that live in the gui namespace.

Ok, that makes sense. It would still rather be considered a good design if I and my fictional team were still using the seperate headers in the actual game project, right?

This topic is closed to new replies.

Advertisement