So basicaly I have my struct that keeps data before assigning it to value of linked list and helps me to retrieve it later
struct Student
{
private:
string surname ;
string names ;
int index;
float mark;
}
and here is my implementation of inserting into sorted linked list
template<typename T>
void List<T>::insert(T v)
{
Node* pred = nullptr;
Node* succ = head;
while(succ != nullptr && succ->value < v) <- here
{
pred = succ;
succ = succ->next;
}
...
my problem is i need to sort it by index and none of my implementations of < operator overloading seems to work
bool operator<(const Student&){
return next->index < this->index;}
I was doing some overloading on operators like == or + but never <, can anyone give me advice how it should look?