I’m trying to convert my implementation of quicksort into a template that can be used with other containers besides a vector.
Originally I used indexes to find the middle index, e.g. (first + last) / 2. How can I find the middle of two iterators?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
std::distancecan measure the distance between two iterators as efficiently as possible.std::advancecan increment an iterator as efficiently as possible.I still wouldn’t want to quicksort a linked list, though 🙂