Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2005-03-09 08:39:11

Hi Daniel,

Daniel James ha escrito:

> Joaquín Mª López Muñoz wrote:
> > Comments on the implementation.
> >
> > 1. The overloads of hash_value for STL containers forces the implementation
> > to include <vector>, <list>, etc., which makes the header a little
> > heavier than desired. Of course, this could be avoided if only there
> > exist <vector_fwd> style headers :( I propose that, instead of including
> > the STL containers headers, they are forward declared:
> >
> > namespace std{
> > template<typenameT,typename A> class std::vector<T, A>;
> > ....
> > }
> >
> > As is known, stdlib implementors are free to add extra template
> > params, so this is not 100% safe, but:
> > * All stdlibs that I'm aware of do not include extra template params
> > * The forward declarations can be tweaked for those stdlibs for
> > which they don't match.
> I'm not happy with this either.

Why not? Sure it has the overhead of checking validity against
every new stdlib that comes around, but you've already commited
to this kind of activity with the workarounds on float_functions.hpp
Besides, the amount of work needed to accommodate a new
library is 0 in most cases and negligible in the rare cases where
extra template parms are used.

> Another possible solution is to just use Boost.Range on anything that
> 'looks' like a container. But this will break on unordered containers
> (as equivalent containers can have different sequences).

Too broad IMHO.

> > 2. It is said in hash.cpp that BCB has problems with the overload
> > of hash_value for bool. This should be fixed in one way or another
> > (possibly by not defining it for this compiler, I guess.)
> It actually says that BCB has problems without it. There was an overload
> ambiguity error for boost::hash<bool> (although, calling
> boost::hash<bool> would be a very odd thing to do) and that was added to
> work around it.

Oh, sorry, I misread it. I agree with you hashing a bool makes little
sense, and agree that it probably shouldn't be made part of the public
interface (for the same reasons, for instance, that there's no overload
for char.)

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

Boost list run by bdawes at, gregod at, cpdaniel at, john at