Hello,
I'm just about to step through my code to replace some unnecessary #includes with forward declaration to speed up compile time. However, I'm looking for some advice or guideline on how far I should take this. Consider this class:
#pragma once
#include "GfxDef.h"
#include "Render/RenderStates.h"
#include "Render/StateGroup.h"
namespace acl
{
namespace gfx
{
class IMesh
{
public:
virtual ~IMesh(void) = 0 {}
virtual unsigned int GetStateCount(void) const = 0;
virtual const render::StateGroup** GetStates(void) const = 0;
virtual const render::DrawCall& GetDraw(void) const = 0;
};
}
}
Obviously, this interface doesn't need to know anything about eigther StageGroup or DrawCall, so forward declaration would obviously do. However I need to include the header files whenever I want to use the interface. Furthermore, if I implement a class using this interface, I can still use the (existing) forward declaration, but at some point I will need to include the header files again, probably in the application code. Whats preferable in this case? When should I use forward declaration or when should I still include header files in such a use case?