Problem with vector sorting

I seem to be running into issues trying to sort a vector of objects in Root. I have created a test program just to work out the details, here is the code:

[code]#include
#include

struct Myobject
{
int m_var1;
int m_var2;

Myobject(): m_var1(-3), m_var2(-3) {}
Myobject(const int v1, const int v2): m_var1(v1), m_var2(v2) {}

bool operator<(Myobject rhs)
{
	return m_var2 < rhs.m_var2;
}

};

void vectortest()
{
vector listo;
Myobject placeholder;
listo.push_back(placeholder);
for (int i=5; i>0; i–)
{
placeholder.m_var1 = i+2;
placeholder.m_var2 = 5*i;
listo.push_back(placeholder);
}
for(int i=0; i<listo.size(); i++)
{
cout<< listo[i].m_var1 << “\t”;
cout<< listo[i].m_var2 << endl;
}
std::sort(listo.begin(), listo.end());
cout << “AFTER” << endl;
for(int i=0; i<listo.size(); i++)
{
cout<< listo[i].m_var1 << “\t”;
cout<< listo[i].m_var2 << endl;
}
}
[/code]

When I run this code, here is my output:

root [0] .Xk vectortest.cpp -3 -3 7 25 6 20 5 15 4 10 3 5 Error: Function __linear_insert(first,i,value_type(first)) is not defined in cur rent scope algo.h(814)

Is there some blatantly obvious command I am missing to fix this? To me, it seems like there is a problem with the header file, but I opened it up and looked at it and the __linear_insert function seems to be defined.

Thanks in advance for helping out.

Hi,

Humm … there is probably a problem with C++ emulation of algo.h. Try using ACLiC:.X vectortest.cpp+

Cheers,
Philippe.