[ROOT] Problem with template vector<>

From: Kay Ulbrich (ulbrich@iskp.uni-bonn.de)
Date: Mon Mar 22 2004 - 16:13:12 MET


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_1596.0_plab_2354.2"));
  odsetnames[2][0].push_back(TString("lehar-satu_NPB294,1013(87)_2354.2_tkin_1596.0_plab_2354.2__2"));
  odsetnames[2][0].push_back(TString("ball-satu_EPJA11,51(1999)_2353.1_tkin_1595.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



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET