Subject: Re: [boost] Proposed templated integer_sort
From: Steven Ross (spreadsort_at_[hidden])
Date: 2009-02-02 17:14:38
On Mon, Feb 2, 2009 at 1:47 AM, Phil Endecott <
> I've added these static assertions in the casting methods:
>> BOOST_STATIC_ASSERT(sizeof(cast_type) == sizeof(data_type));
>> That should guarantee I'm casting an IEEE floating-point number to an
>> integer of the same size.
> I was imagining that you'd use these to enable a specialisation, e.g. using
> enable_if, rather than in asserts.
I suppose I could call just call std::sort for situations where any of those
asserts would fail, but I think a compile error is more appropriate. Can
you think of a usage case with a standards-compliant C++ compiler where
someone would want to use float_sort but those assertions fail for a reason
other than user error?
If not, I believe telling the user that they're using it wrong via a static
assertion failure is more appropriate.