I/O type limts in ROOT6?

Assume some type MyClass complies with all C++ standards and ROOT6 is used. In principle, should MyClass always be write-able to a .root file, provided it is a public descendant of TObject and includes the ClassDef macro? What if MyClass does’t descend from TObject nor include the ClassDef macro?

Right now, I have trouble in both scenarios and am unsure why that is. For example, the code below compiles via .L Test.cc++, but always yields an error when run:

#include
#include <TFile.h>

using std::array;

struct MyClass {
array<double,4> Vals {{1,2,3,4}};
};

void Test()
{
TFile Out {“TestOut.root”, “recreate”};
MyClass Temp {};
Out.WriteObject(&Temp,“PersistentName”);
}

Warning in TStreamerInfo::Build:: MyClass: array<double,4> has no streamer or dictionary, data member “Vals” will not be saved

This version gives the same error:

#include
#include <TFile.h>

using std::array;

struct MyClass : public TObject {
array<double,4> Vals {{1,2,3,4}};

ClassDef(MyClass,1);
};

void Test()
{
TFile Out {“TestOut.root”, “recreate”};
MyClass Temp {};
Temp.Write(“PersistentName”);
}

I’m running ROOT6 beta 3 on OS X 10.9.2, with Xcode 5.1.

Hi,

at the moment ROOT6 does not support IO of c++11 constructs, as for example the std::array. We are of course discussing what is the best strategy and related timescale to lift this limitation and to what extent.
If IO matters are interesting for you, you could decide to attend the forthcoming ROOT IO workshop: indico.cern.ch/event/311573/

Best,
Danilo

Hi Danilo,

Thanks for the info about both ROOT’s current status and the workshop.

Is there a list of ROOT’s issues of this kind, analogous to the list of CINT’s limitations vis-a-vis C++?

Cheers,
Patrick

Hi Patrick,

not yet. It’s in the plan for the release at the end of May.
In any case, we value very much proposals (or bug reports) of our users. We have a Jira instance to offer for this purpose:
sft.its.cern.ch/jira/browse/ROOT
It is a bug tracker, the re-incarnation of the old savannah, which helps to keep track of all the action items related to the project.

Cheers,
Danilo