Boost logo

Boost :

From: Joaquín M LópezMuñoz (joaquin_at_[hidden])
Date: 2005-03-22 10:33:15


Daniel James <daniel <at> calamity.org.uk> writes:

>
> Thorsten Ottosen wrote:
> > |I think Thorsten is referring in part to some off list emails, and in
> > |part to when I wrote (about removing the includes for all the standard
> > |containers):
> > |
> > |> 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).
> > |
> > |I forgot to mention that there's no way to tell what 'looks' like a
> > |container at all. Joaquín replied:
> > |
> > |> Too broad IMHO.
> > |
> > |So, I think we all rejected the idea. It would be nice if there was a
> > |way to do something like that, but there isn't.
> >
> > that Joachin don't like the idea is ok, it's just not an arguemnt in favor
of
> > much.
>

Of course :)

My concern about the idea is that we can do better by
simply fowrard declaring the STL containers:

namespace std{
template<typename T,typename A>
class vector;
}

template<typename T,typename A>
std::size_t hash_value(const std::vector<T,A>& x)
{
...
}

etc. The problem with this approach is that it is
allowed that stdlib implementors use extra template parameters.
>From my point of view, this is just a maintenance issue:
if there's a stdlib (none that I know, anyway) with extra
parameters we can sync the forward declarations for this
particular case and be happy.

This is meant to avoid the inclusion of std headers
for STL containers, since they're extra overhead when
their corresponding hash overloads aren't to be used.

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


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