A walkthrough of implementing compile-time quicksort in modern C++14 using idiomatic techniques. Covers representing integer sequences with std::integer_sequence, building a concat template to merge sequences, implementing a partition template with unary predicates, and assembling the full recursive quicksort. The implementation is compared favorably to a 2011 version, highlighting how alias templates (concat_t, quicksort_t) and std::conditional_t reduce verbosity and improve readability. A note on pivot selection and O(n²) worst-case behavior is included.
Table of contents
Output Copy link Link copied!Concatenating sequences Copy link Link copied!Partitioning Copy link Link copied!Quick sort Copy link Link copied!A word on performance Copy link Link copied!Wrap up Copy link Link copied!3 Impressions