when this copy constructor is called in my application, this copy constructor goes into an infinite loop i.e it keeps calling itself.
When i debugged the pogram terminated at the first line itself.
The foreach loop used is a Qt foreach.
template<class TValue>
Locus<TValue>::Locus (const Locus<TValue>& source ) : QVector<TValue>(source) // program terminates here
{
std::cout << "calling self from here " << std::endl;
foreach (typename Locus<TValue>::value_type l, source)
{
this->push_back(l);
}
}
From the Qt docs: