Merge pull request #25 from rubicks/ceeplusplus

adds sort_by function template and uses it in Palette and Quantize