Hello Dear ROOTers!
I am trying to use stl containers in rootcint, which was working fine until i tried to used the sort algorithms with vectors.
In an earlier post i found, that this script:[code]#include
#include
void test()
{
vector<Int_t> a;
a.push_back(2);
a.push_back(1);
cout << “DEBUG before: a = (”;
for (size_t i = 0; i != a.size(); ++i) {
cout << a.at(i);
if (i != (a.size()-1))
cout << ", ";
} // for (i)
cout << “)” << endl;
std::sort(a.begin(), a.end());
cout << “DEBUG after : a = (”;
for (size_t i = 0; i != a.size(); ++i) {
cout << a.at(i);
if (i != (a.size()-1))
cout << ", ";
} // for (i)
cout << “)” << endl;
}[/code]
is supposed to work. In my root installation (5.22, self compiled) it doesn’t. I get the following error message:
[ddodt@jac-67 ~]% root -l code/work/test.C
root [0]
Processing code/work/test.C...
DEBUG before: a = (2, 1)
Error: operator- not defined for vector<int,allocator<int> >::iterator algo.h:722:
*** Interpreter error recovered ***
when I understand the post
root.cern.ch/phpBB2/viewtopic.ph … 06fa647890
correctly, then a similar error message used to appear in an old version of root (<5.18), because some other std::sort function is called (??) and in principle this shouldn’t happen, when is included (??)
any help apreciated, possibly i should stay away from stl in rootcint? kind regards
Dirk