api independent...

Started by
1 comment, last by Thaligar 18 years, 7 months ago
hi folks, i finally get an api independent texture class to work (multiple inheritance), my brain was some kind of dizzy during the implementation, well now i try to get it to run with the handlemanager from "Games Gems I" and now the problem, the handlemanager tries to create a template object through the std. constr., well not a problem but if i pass as template parameter the texture interface class the compiler hangs, (well not surprising) but how can i get it to run without implementing one handlemanager for each texture (2D, 3D, 1D...), because it works without a problem when i pass as template not the interface class but the specialized class, thanks in advance for your time (for reading this as well as participate), greets tgar
Advertisement
I don't know this particular handlemanager class, but if it is/has a collection of your objects, then the simple answer is you need to store pointers to the interface class, not the interface class itself.

Example:

class A {   int a;public:   virtual int value() const { return a; }};class B : public A {   int b;public:   virtual int value() const { return b; }};std::vector<A>  as;   // bad!std::vector<B>  bs;   // okstd::vector<A*> pas;  // also okpas.push_back(new B);


Without seeing handlemanager, I'm guessing it's a similar situation as the vector in my example.
now i feel a little bit dumb,

thanks,
greets
tgar

This topic is closed to new replies.

Advertisement