[ROOT] ROOT and STL

From: Sam Waldman (waldman@hep.Stanford.EDU)
Date: Wed Aug 28 2002 - 19:34:58 MEST


	Hi folks,

	I realize STL and CINT aren't necessarily supposed to play nice
together,  but I have managed to get it to work,  sort of.  This  script
works:

/*******  Working Script -- test.c ***********/
{

#include <vector>
vector<int> myv;

for(int i=0; i<100; i++) {
  myv.push_back(i);
}

TGraph myg( myv.size() , (int*) &(myv[0]) , (int*) &(myv[0]) );
myg.Draw("A*");

}

// end of script

	And this script doesn't work:

/******** Broken Script -- test.c **************/

#include <vector>

test() {

vector<int> myv;

for(int i=0; i<100; i++) {
  myv.push_back(i);
}

TGraph myg( myv.size() , (int*) &(myv[0]) , (int*) &(myv[0]) );
myg.Draw("A*");

}

// end of script

	This script does a variety of bad things.
	Aside from the general fact that this isn't the prettiest code
ever seen,  and STL and CINT don't work together, is there something I am
doing wrong?

	Thanks for the help,

	sam



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:06 MET