mohitanand001 / underscore_cpp

underscore_cpp
MIT License
7 stars 30 forks source link

Sorting a const container #28

Closed gotham13 closed 6 years ago

gotham13 commented 6 years ago

https://github.com/farziengineer/underscore_cpp/blob/ced412c47cc05ebaeb9b57437e625e16b28600bc/underscore.cpp#L253

It is not possible to sort a const container so this line is giving an error. We can either pass non const container or a set. Please look into it @farziengineer

mohitanand001 commented 6 years ago

I think we should pass the containers by value just like we have in intersection, so that the original containers also do not change (while sorting) and we do not need to const. https://github.com/farziengineer/underscore_cpp/blob/97f931369787f57dec635060d02f44e333fcd2e1/underscore.cpp#L211