| Home | Libraries | People | FAQ | More

#### Usage

Pattern-defeating quicksort is available through two calls, ``pdqsort`` and ``pdqsort_branchless``. Both have identical guarantees, behavior and overloads as std::sort, with the exception of the C++17 parallel execution policy argument. Thus you can replace a call to std::sort with boost::sort::pdqsort, available from boost/sort/pdqsort/pdqsort.hpp, it is simply a faster implementation. It is almost always appropriate to simply call ``pdqsort`` and ignore ``pdqsort_branchless``.

``pdqsort_branchless`` runs significantly faster than ``pdqsort`` for comparison functions that are branchless (for an explanation why see 'The Average Case' below), such as simple integer or float comparison, and slightly slower when the comparison function contains branches. When using an arithmetic type and a default comparison function (std::less or std::greater) ``pdqsort`` automatically delegates to ``pdqsort_branchless``. If you know that your custom comparison function is branchless and wish to make use of this speedup call ``pdqsort_branchless`` explicitly.