Hi Brandon, See the Release Notes about this question at: http://root.cern.ch/root/htmldoc/examples/Version302.news.html Look at section "Template Support" Rene Brun On Fri, 18 Jan 2002, Brandon Kohn wrote: > HI Rene, > > I'm trying to do some template stuff with root (basically just want the > autodocs to document my template class), but I'm having trouble finding a > definitive how-to or faq on using templates with root. The part that I'm > fuzzy on is how or where to place template instantiations to correspond with > the ones in the linkdef: > > I.e. > > #ifdef __CINT__ > > #pragma link off all globals; > #pragma link off all classes; > #pragma link off all functions; > > #pragma link C++ class LD_Template_Array<int>-; > #pragma link C++ class LD_Template_Vector<int>-; > > #endif > > Now I have to instantiate LD_Template_Array<int> somewhere right? > > As it stands, here is the error I get when compiling the dictionary created > with the above linkdef: > > NeutralDictionary.cpp(89) : error C2143: syntax error : missing ';' before > '<' > NeutralDictionary.cpp(89) : error C2373: '>>' : redefinition; different type > modifiers > NeutralDictionary.cpp(89) : error C2530: '>>' : references must be > initialized > NeutralDictionary.cpp(89) : error C2143: syntax error : missing ';' before > '<' > NeutralDictionary.cpp(90) : error C2143: syntax error : missing ';' before > '{' > NeutralDictionary.cpp(90) : error C2447: missing function header (old-style > formal list?) > NeutralDictionary.cpp(98) : error C2143: syntax error : missing ';' before > '<' > NeutralDictionary.cpp(98) : error C2373: '>>' : redefinition; different type > modifiers > NeutralDictionary.cpp(98) : error C2530: '>>' : references must be > initialized > NeutralDictionary.cpp(98) : error C2143: syntax error : missing ';' before > '<' > NeutralDictionary.cpp(99) : error C2143: syntax error : missing ';' before > '{' > NeutralDictionary.cpp(99) : error C2447: missing function header (old-style > formal list?) > > And here is the code where the errors are occuring in the Dictionary file: > > template <> TBuffer &operator>><int >(TBuffer &buf, LD_Template_Array<int> > *&obj) > { > // Read a pointer to an object of class LD_Template_Array<int>. > > ::Error("LD_Template_Array<int>::operator>>", "objects not inheriting > from TObject need a specialized operator>> function"); if (obj) { } > return buf; > } > > //__________________________________________________________________________ > ____ > template <> TBuffer &operator>><int >(TBuffer &buf, LD_Template_Vector<int> > *&obj) > { > // Read a pointer to an object of class LD_Template_Vector<int>. > > ::Error("LD_Template_Vector<int>::operator>>", "objects not inheriting > from TObject need a specialized operator>> function"); if (obj) { } > return buf; > } > > > > Hope this is a good enough description, and thanks in advance for any help. > > > > Brandon >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:38 MET