23 Jan 2002 mikem   » (Journeyer)

C++ templates suck.

i just spent half a day getting Jade to compile, because the damn thing is packed to the rafters with templates.

Of course, every damn compiler implements templates in a different way. Try deciphering this load of trash:

In file included from ../include/CharsetInfo.h:11, from CharsetInfo.cxx:8: ../include/Vector.h: In instantiation of `Vector<RangeMapRange<unsigned int,unsigned int> >': ../include/RangeMap.h:27: instantiated from `RangeMap<unsigned int,unsigned int>' ../include/UnivCharsetDesc.h:73: instantiated from here ../include/Vector.h:50: `Vector<RangeMapRange<unsigned int,unsigned int> >::operator [](unsigned int)' has already been declared in `Vector<RangeMapRange<unsigned int,unsigned int> >'

After banging my head againt the wall for a while, i discovered the problem i'm having stems from template instantiation with consts. The compiler doesn't like two member functions in a template class differing by only a const... Something like

int operation[](int x) const; int operator[](const int x);

It compiles better if i remove the AC_C_CONST check from configure.in, but won't link now...

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!