+ 1

Problem in sorting forward_list || cpp

Please look at function func6 in the code and comment on the real issue, I am not able to get the problem. I appreciate everyone's comment.❤️❤️❤️ https://code.sololearn.com/cYj49dIZuS2I/?ref=app

21st Dec 2021, 6:16 AM
saurabh
saurabh - avatar
4 Respostas
+ 4
If you overload it as a member function, you need to mark operator < (any non-modifying method, really) as const. The comparison function needs to be able to accept values of all value categories, which a non-constant reference can not, and may not modify its arguments anyway.
21st Dec 2021, 8:10 AM
Shadow
Shadow - avatar
+ 3
Implement this code at the very top so your code will work. using namespace std;
21st Dec 2021, 8:21 AM
SoloProg
SoloProg - avatar
+ 2
In func6 To avoid running the code remark this line of code as it gives you error as an output. //l1.sort();
21st Dec 2021, 8:11 AM
SoloProg
SoloProg - avatar
21st Dec 2021, 10:38 AM
SoloProg
SoloProg - avatar