How to implement classic sorting algorithms in modern C++?

The std::sort algorithm (and its cousins std::partial_sort and std::nth_element) from the C++ Standard Library is in most implementations a complicated and hybrid amalgamation of more elementary sorting algorithms, such as selection sort, insertion sort, quick sort, merge sort, or heap sort. There are many questions here and on sister sites such as https://codereview.stackexchange.com/ related to … Read more

Is the practice of returning a C++ reference variable evil?

This is a little subjective I think; I’m not sure if the opinion will be unanimous (I’ve seen a lot of code snippets where references are returned). According to a comment toward this question I just asked, regarding initializing references, returning a reference can be evil because, [as I understand] it makes it easier to … Read more