Hello,
I was trying to store a std::vector<std::array<ULong64_t, 2>>
in a TFile and everything works perfectly when I read and write from my mac (I am on Sonoma with a M3 mac). Here an example code:
#include <array>
#include <iostream>
#include <vector>
#include "TFile.h"
#pragma link C++ class std::vector<std::array<ULong64_t, 2>>+ ;
void writeVector() {
std::vector < std::array < ULong64_t, 2>> test { { 1ull, 2ull }, { 3ull, 4ull }, { 5ull, 6ull } };
TFile f("test.root", "RECREATE");
f.WriteObject(&test, "test");
f.Close();
}
void readVector() {
TFile f("test.root");
auto test = f.Get<std::vector<std::array < ULong64_t, 2> > >("test");
for (auto &a: *test) {
std::cout << a[0] << " " << a[1] << std::endl;
}
f.Close();
}
If I try to read from a Linux machine (x86-64) the same file I get the following error:
Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with a checksum of 0x44178e08 for the class "array<ULong64_t,2>" in test.root.
Error in <TBufferFile::CheckByteCount>: object of class array<ULong64_t,2> read too few bytes: 6 instead of 22
Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with a checksum of 0x44178e08 for the class "array<ULong64_t,2>" in test.root.
Error in <TBufferFile::CheckByteCount>: object of class array<ULong64_t,2> read too few bytes: 6 instead of 22
Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with a checksum of 0x44178e08 for the class "array<ULong64_t,2>" in test.root.
Error in <TBufferFile::CheckByteCount>: object of class array<ULong64_t,2> read too few bytes: 6 instead of 22
If I try to create the same test.root file on Linux and then read it on the mac, I get the same error.
We tried with a colleague to read the test.root produced on the ARM mac on a Intel mac and it works.
Is there something I am missing to make these objects readable across operating systems?
I am using on both machines ROOT 6.30/01 (with ALICE patches).
Cheers,
Max