Hi Michael, My understanding of the STL vectors is that it is safe to assume that the elements are contiguous. See the discussion in roottalk in December, eg http://root.cern.ch/root/roottalk/roottalk01/4416.html So, you should be able to pass directly the address of your vector to TGraph, etc. Also, note the various ways to construct a TGraph, TGraphErrors, etc. eg, you can do TGraph *gr = new TGraph(n); This will reserve the space for n points. You can then use TGraph::SetPoint Rene Brun Michael Wiesmann wrote: > > Hi Colin! > > > As root was not compiled with STL (why not, Rene ?), > > root classes don't know about it. I also think it would be pretty > > useful to have TTree/Branch classes know about the vector container. > > > > Anyway, even if you don't know how many points you have in your file, or > > how many points you want, you can reallocate memory for your arrays > > manually : > > > > float *x = malloc(100); > > .... I just remember that "malloc" is one of the things not to be used > in c++ ... > > My current idea is to read in an stl container and than copy this to an > array. The obvious way would be to use knowledge about how vector is > implemented in stl, but this I do not like. > I was looking for something like vector::MakeArray(), which > doesnt seem to exist. Pity ... > > Anyway, thanks for the confirmation of the missing stl ... > > BTW, the latest version 3.02 offers a TGraph::TGraph(TVector, ....), > which could help a bit. But unfortunately I need a TGrahpErrors, which > seems not yet to be updated ... > > Michael
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET