Upon running the following code:
std::vector<float> v = {1., 2., 3.};
std::unordered_map<std::string, std::vector<float>> m = {{"str", v}};
auto json = TBufferJSON::ToJSON(&m, TBufferJSON::kMapAsObject);
I am getting
error: 'kMapAsObject' is not a member of 'TBufferJSON'
The same happens with other enum
elements.
ROOT Version: 6.14/09
You need ROOT 6.18 for “kMapAsObject”.
Thank you.
In general, is there any way to check the ROOT version required to use a particular class method/member? Something along the following lines:
ROOT::RequiredMinimumVersion(TBufferJSON::kMapAsObject);
I have also just noticed that the class does not work as expected for vectors with dimension higher than 2:
std::vector< std::vector< std::vector< std::vector<float>>>> x;
/* ...
fill x values
... */
std::ofstream o("file.json");
auto json = TBufferJSON::ToJSON(&x);
o << json << std::endl;
only displays two out of the four dimensions.
linev
August 27, 2019, 10:24am
5
Yes, I can reproduce problem when vector x
has exactly one element. In such situation dimension disappears. I will try to fix it.
linev
August 27, 2019, 12:03pm
6
Hi @bfontana ,
Fix is there https://github.com/root-project/root/pull/4290 and will be merged soon into the master.
Thanks for reporting it,
Sergey
system
Closed
September 10, 2019, 12:04pm
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.