[ROOT] TreePlayer parser confusion?

From: troy d. straszheim (troy@resophonic.com)
Date: Mon Dec 20 2004 - 01:04:43 MET


Hi roottalk:  

I'm trying to compare some classes in trees.  This code shows the problem:

#include <TTree.h>
#include <TFile.h>

template <class T>
struct B { int i; };

struct C : B<void> { };

void plot_my_i() 
{
  C c, *cp(&c);
  
  TTree *t = new TTree("mytree", "Icecube", 10000);

  t->Branch("plot_my_i.", "C", &cp);
  t->Branch("against_my_i.", "C", &cp);

  for (int i=0; i<100; i++)
    {
      c.i=i*13;
      t->Fill();
    }
  t->Draw("plot_my_i.B<void>.i:against_my_i.B<void>.i");
  t->StartViewer();
}

So when a class further up in the inheritance hierarchy is a template,
the angle-brackets get into the branch path, the treeplayer sees them
as comparisions and things dont work.  I have tried intermediate
typedefs to outsmart rootcint:

template <class T> struct B { int i; };
typedef B<void> B_void;
struct C : B_void { };

but rootcint goes around them and the typedeffed name does not appear
in the branch path.  Any ideas?  

Thanks,

troy d. straszheim



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