Comparators implementation, function by reference and stl sort function

i have a doubt in this code where the function is passed as reference that will it work if i pass lambda function?? i am really confused with it as in the previous video sort function was taught and sort function can accept a comparator function as well as a lambda function and this video is about explaining the implementation of that sort function i.e. how it works internally.

But if function is passed by reference in this, then i have a doubt that if we pass lambda function it will act as R-value i think and according to move semantics this method of reference is for L-value reference then how sort function works when we even pass lambda function or a comparator function as argument.

please help me by clearing this doubt.

hello @Rajat02

comparator provides logic for comparing two elements.
now it is upto u how u pass it to another function for making comparision, either by making a lambda function or by a general function.

Thank you @aman212yadav for answering,
But can you please tell me are lambda functions passed as R-values??

@Rajat02
what do u mean by L and R value , i dont know these terminologies

@aman212yadav L-values and R-values according to c++ 11 move semantics to give reference to a variable.

@Rajat02
do u have any link or something regarding same

@aman212yadav no that I don’t have it was told by one of my teacher

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.