Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-03-07 17:20:09


On Fri, Mar 07, 2003 at 08:09:35PM +0100, Gennaro Prota wrote:
> On Fri, 7 Mar 2003 18:17:56 +0100, Pavol Droba <droba_at_[hidden]>
> wrote:
>
> >I wanted to do something else:
> >
> > template <class T> struct trait_class
> > {
> > ....
> > }
> >
> > template <class T> struct trait_class<std::vector<T> >
> > {
> > ....
> > }
> >
> >without #include <vector>
> >
> >Is this possible?
>
>
> Practically speaking, no. At least not in a portable, conforming way.
> You can (under certain limitations) provide specializations like
>
>
> class A { };
> namespace std { template<> class numeric_limits<A> {}; }
>
>
> but you can't otherwise add declarations to std. There are several
> reasons for this limitation.
>
> AFAIK the committee discussed the possibility to provide fwd versions
> of standard headers other than <iosfwd> but decided not to do so.
>

My question is then following:
   How do the boost libraries solve this problem?

I see only 2 possibilities, both not very nice.
- Silently include all stl container headers ( or at least meny of them )
- Divide the specialization into several files ( one for each container ) and
  ask the user to include the specific one.

Is there some other option I don't know about?

Pavol


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