I writing an “Effect” class (for an opengl program) and I’m also attempting to write a container class for.
The Effect class is defined as follows:
template <typename T>
class Effect
{
private:
Vbo<T> m_Vbo;
};
Where T is a type that describes the vertex attributes.
In order to write a container class, I’d like to store these effects in an std::map:
class EffectMgr : public Singleton <EffectMgr>
{
private:
typedef std::map<std::string, Effect<T> & > EffectMap;
};
The error I get with the container class is that T is undefined. Can someone enlighten me?
I may have (by sheer chance and tinkering) have found the answer although I won’t know until I’ve written the container class:
class EffectMgr : public Singleton <EffectMgr>,
{
private:
template <typename T>
typedef std::map<std::string, Effect<T> & > EffectMap;
};
Tis scoped within the Effect definition. Outside of the scopeTis undefined.Perhaps you mean this?
If you want only the typedef to be templated then do this: