[Kde-pim] Abiguity in kleopatra/mainwindow.cpp

Adriaan de Groot groot at kde.org
Tue Apr 22 22:40:50 BST 2008


I'm looking at this bit of code in kleopatra/mainwindow.cpp:

    template <typename T>
    void createAndStart( QAbstractItemView * view ) {
        ( new T( view, &this->controller ) )->start();
    }
    template <typename T, typename A>
    void createAndStart( const A & a ) {
        ( new T( a, this->currentView(), &this->controller ) )->start();
    }

which my compiler (SS12) says is ambiguous -- you can substitute 
QAbstractItemView * for A -- so kleopatra doesn't compile. I can't figure out 
what the right way of writing this down is -- partial template function 
specialization is not my forte and mostly I end up with the compiler 
complaining that an explicit parameter list is not allowed in a primary 
template.

The three uses of the second template all take arguments of type QStringList, 
so in my local copy I've just written it out and removed the typename A 
template parameter.

What would be the best solution in this case?

[ade] (please CC: i might be subscribed, but delivery is certainly set 
to 'off')
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list