ROOT I/O: Cannot persist an std::array of class template objects

Hi!

I am encountering a problem when trying to persist an std::array of template class objects. When I have a data member in my class C like std::array<A<int>> foo, where A is a class template, I get the following error when I write a C object to file:

Error in <TStreamerInfo::Build>: C, unknown type: A foo

However when I hardcode the type of the class template (making it a regular C++ class), persisting the class works fine and I get no error. I also tried std::vector<A<int>> foo which also seem to persist without a problem.

I made a reproducer that can be found here: https://github.com/Senui/root_io_template_array

In the reproducer class A is a template, class B is a regular C++ class, and class C contains the STL containers of class A and B. Can anyone tell me why my std::array<A<int>, 3> object cannot persist? And can I fix this or is it not supported yet?

Best,
Ahmad

Edit: using ROOT v6.08.06 (which should have support for std::array)

What version of ROOT are you using?

Hi,

I can reproduce. I am on it.

D

Updated my first post to include the used ROOT version. Thanks Danilo!

Hi Ahmad,

I propose to follow this issue on Jira: https://sft.its.cern.ch/jira/browse/ROOT-8736
The testsuite has been extended to cover this case too and a fix has been pushed to the master. It will be back ported to 6.08 soon.

Cheers,
D

1 Like

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