On Monday, March 22, 2004, 15:36 -0600, Philippe Canal wrote: > Hi, > > Your initial problem is a deficiency in CINT's handling of local object. > Masa is currently working to fix the problem. > > In the meantime you have two work around. One is to compile your code by > just doing > .L vector.C+ > (you will need to add a few more header file and change the name of > the macro). > Or you can allocate your object using new vector<TString>[27] > > Cheers, > Philippe. > > -----Original Message----- > From: owner-roottalk@pcroot.cern.ch > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Kay Ulbrich > Sent: Monday, March 22, 2004 9:13 AM > To: roottalk@pcroot.cern.ch > Subject: [ROOT] Problem with template vector<> > > > Hello, > > I am using ROOT Version 3.10/01, output of uname -a: > Linux HOST 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown > > I have reproduced the problem I am encountering in a sample script. > > //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > // Begin of source code > > #include <vector> > > void vector(void) > { > vector<TString> odsetnames[9][3]; > > > odsetnames[2][0].push_back(TString("bell-anl_PLB94,310(80)_2250.5_tkin_1500. > 0_plab_2250.5")); > > odsetnames[2][0].push_back(TString("lehar-satu_NPB294,1013(87)_2354.2_tkin_1 > 596.0_plab_2354.2")); > > odsetnames[2][0].push_back(TString("lehar-satu_NPB294,1013(87)_2354.2_tkin_1 > 596.0_plab_2354.2__2")); > > odsetnames[2][0].push_back(TString("ball-satu_EPJA11,51(1999)_2353.1_tkin_15 > 95.0_plab_2353.1")); > > cout <<odsetnames[2][0].size()<<endl; > } > // End of source code > // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > When calling "root vector.C", the output I get is (I have stripped the > startup output): > > -- begin of output -- > > root [0] > Processing vector.C... > 4 > > *** Break *** segmentation violation > Generating stack trace... > > -- end of output -- > > So obviously the vectors are initialised and > vector<TString>::push_back() and vector<TString>::size() work, but > nevertheless I get a segmentation fault. Is there something I should > do in a different way? > > By the way, if I change the script such, that the include statement is > placed in the function block: > > //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > // Begin of source code > void vector(void) > { > > #include <vector> > > [ ... ] > > } > // End of source code > // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > I get the output: > > -- begin of output -- > > root [0] > Processing vector.C... > Error: class,struct,union or type input_iterator_tag not defined > FILE:/usr/local/cern/root/cint/stl/algobase.h LINE:63 > Internal error: global function template arg type > FILE:/usr/local/cern/root/cint/stl/algobase.h LINE:63 > *** Interpreter error recovered *** > > -- end of output -- > > Thank you for your suggestions, > Kay > > Hello Philippe, thank you for your answer -- now it works. Could you please explain to me, why the second problem occurs, I mean, why it makes a difference, whether "#include <vector>" is outside the macro (no error) or inside the macro (error)? I do not seem to understand this. Thank you, Kay -- ====================================================================== Kay Ulbrich Helmholtz-Institut fuer Strahlen- und Kernphysik der Universitaet Bonn Tel.: +49-228-73 1768 Nussallee 14-16 Institute FAX: +49-228-73 2505 D-53115 Bonn, Germany E-mail: ulbrich@iskp.uni-bonn.de ======================================================================
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET