Hi!
I try to get a (for me) rather complex construct of templated code to work.
what i have: a class shaderProperty of generic type
class IShaderProperty {
public:
virtual ~IShaderProperty() {}
};
struct IShaderMatth; //forward declaration
template<typename ShadeType>
struct ShaderMatth;//forward declaration
template <typename T>
class ShaderProperty : public IShaderProperty
{
public:
template <typename SomeType>
inline T getValue(ShaderMatth<SomeType>* shaderMatth){
pair<map<void*, IShaderMatth>::iterator,bool> success = shaderMatth->properties.insert(make_pair((void*)this, ShaderMatth<T>(m_shader)));
assert(success.second);
return m_shader->shade((ShaderMatth<T>*)&(*success.first));
}
};
and the class ShaderMatth, which is also of generic type, and stores a map whereas the void* pointer used as key is actually a pointer to a ShaderProperty. Code for ShaderMatth:
#include "ShaderProperty.h"
struct IShaderMatth {
virtual ~IShaderMatth() {}
map<void*, IShaderMatth> properties;
...
};
template <class ReturnType>
struct ShaderMatth : public IShaderMatth{
ShaderMatth(IShader<ReturnType>* shaderPtr){shader=shaderPtr};
~ShaderMatth(void);
IShader<ReturnType>* shader;
};
now the error occurs on the first line of function inline T getValue()
i get an
Error C2027 use of undefined type 'ShaderMatth<ShadeType>'
but i don't understand why.. I have the forward declaration of templated struct ShaderMatth, and in the second bunch of code i include the first bunch of code, so the forward reference should work out, no?
I'm hanging - please help :)