On Jul 21, 2013, at 10:58 AM, Steven Ross
I'm not real sure about the interface, though: do they have to be different named functions (integer_, float_, string_)? Can't it be called bucket_sort() and specialized for different types?
[snip]
With regards to different types, this covers three different cases: sorting by an integer or integer-like key of finite length, sorting a float correctly by casting it to an integer (tricky but fast), and sorting strings of variable length. Specializing by type isn't ideal as people often want to sort larger data types by a key, and the key could itself be a more complex data type that isn't an integer, float, or string, but supports the necessary operators.
Use a function template, don't implement the primary specialization. Just implement the specializations you support. If you dispatch to a static member function of a class template, PTS with type traits can give wider support without specializing for otherwise similar types. (all integral types, for example). ___ Rob (Sent from my portable computation engine)