> __last and __first were copied from std::sort. Is there a good reason I
> shouldn't use the same notation?

Yes; you're not writing the standard library.

> I'd like to use a smart pointer, but is there one that will call delete[]?

With the way that you've now structured the code, I think your choice
is between a boost::scoped_array (the difference between scoped_ptr and
scoped_array is delete vs. delete[]), or to avoid dynamic allocation by
using a std::vector. If the number of bins is knowable at compile time
then a std::tr1::array or C-style array is another choice, but some
people might complain about having so much data on the stack.

I have previously asked, probably on this list, about whether there's a
good way to detect iterators that point to contiguous storage. The
answer seems to be that there isn't, except for explicitly detecting
those that are guaranteed to do so (as above).