Implemented my_sort with template selector.