Boost logo

Boost :

Subject: Re: [boost] radix sort
From: Steven Ross (spreadsort_at_[hidden])
Date: 2013-07-22 06:33:04


>
> 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).
>

Won't the user have to give their class a trait to use the function, if it
isn't a raw integer type?
The other concern is that the integer and string algorithms are different
in terms of
worst-case performance, as the string algorithm has to deal with
variable-length inputs.

Currently there is a spread_sort wrapper that selects integers or floats
using PTS,
and failing that, defaults to std::sort. I've yet to see a way to identify
that a data type is string-like.
I can remove the fallback if that's the desired behavior
(to avoid confusing the user about which algorithm is in use), but that
doesn't resolve the string issue.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk