right place Template specialization

Andreas Pakulat apaku at gmx.de
Sat Jan 31 13:44:51 CET 2009


On 31.01.09 02:46:45, Patrick Spendrin wrote:
> Andreas Pakulat schrieb:
> > Hi, 
> > 
> > I've got a tricky problem here and templates are still mysterious to me
> > outside of the usage of QMap/QList&Co.
> > 
> > If you look at
> > http://websvn.kde.org/trunk/KDE/kdevelop/plugins/languages/cpp/cppduchain/templatedeclaration.cpp?view=markup
> > http://websvn.kde.org/trunk/KDE/kdevelop/plugins/languages/cpp/cppduchain/templatedeclaration.h?view=markup
> > 
> > You'll see
> > virtual Declaration* resolve(const TopDUContext* /*topContext*/) const
> > around line 273 in the header and a specialization of this method in line
> > 1021. As you can see the function in the header asserts in all cases, the
> > specialization does something useful.
> > 
> > Unfortunately for me MSVC always resolves to the non-specialized version in
> > the header. The template parameter matches as far as I can see during
> > debugging (no backtrace at hand right now), but msvc still uses the wrong
> > one. 
> > 
> > I could "fix" it by moving the specialization into the header file, but
> > that breaks compilation on linux/gcc.
> > 
> > Anybody have a hint for me whats going wrong here and why MSVC doesn't see
> > the specialization in the .cpp?
> What looks not right is that the template class should get exported. 
> Normally template classes do not get exported (compare Qt 
> QVector/QList), so I wonder why this should be needed here.
> I am not sure how this should change anything though as you say it 
> compiles fine.

Hmm, but maybe thats the reason it doesn't build on linux anymore when the
specialization is moved to the header... I'll try removing the export-macro
and see wether that fixes compilation on linux...

Andreas

-- 
Tomorrow, this will be part of the unchangeable past but fortunately,
it can still be changed today.


More information about the Kde-windows mailing list