Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, July 2007
are templated interfaces possible ?


Message 1 in thread

I'm trying to implement some transparent/alternative matrix multiplication 
routines, and I figured the simplest way to do this would be via the Qt 
plugin/interface mechanism. However I keep getting strange errors and at this 
point I'm not sure whether I'm missing something or simply the plugin macros 
are not template-proof. What I have for the interface now is roughly

template <typename R, typename C>
class MatrixInterface
{
public:
   virtual ~MatrixInterface() {};

   enum density { sparse, dense };
   enum major { column, row };
   enum matrixop { add, sub };
   virtual bool has(matrixop op) const = 0;

};


Q_DECLARE_INTERFACE(MatrixInterface,
                     "com.MathForFun.QtMath.MatrixInterface/1.0")


and this gives "error: expected initializer before '*' token" on the 
Q_DECLARE_INTERFACE line (works fine without the template line). Apparently 
bc of the macro I cant say MatrixInterface<R,C> as it would split it at the 
comma. Tried looking at the DECLARE_INTERFACE, but it's pretty scary looking 
code for anyone without very deep qt knowledge. Any suggestions, links, 
readings/code or am I simply in too deep water here ?

--
 [ signature omitted ]