STL container of TTree(s)

Dear Users,
I am trying to compose STL containers such as std::vector or std::array made of TTree objects in the way std::vector or std::array<TTree, k>
I am wondering if it is possibile and if push_back() standard member function is working. Apparently it yields an error.
Thank you in advance
Best Regards

_ROOT Version: 6.32.00
_Platform: ubuntu 22.04
_Compiler: gcc-11.4.0

I’m not a ROOT expert, but:

Handing STL containers of TTrees sounds tricky. It would involve copying TTree objects, and those objects may not be easy to copy.

However, containers of TTree* should work. They’d allocate nicely too:

   std::array<TTree*, 12> myTreeArray;
   myTreeArray[0] = new TTree("tree0Name","tree0Description");

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.