Boost logo

Boost :

From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2007-05-15 03:55:40


> May I ask why, or in what situation? I am reminded of Item 2 of
> Meyers "Beware the Illusion of Container-Independent Code". .

--
I posted a trivial examle of writing a generic output stream operator for
all container types.. It works for all containers given that their
value_type also implements the stream operator.
To me it is (was) an occuring task to overload container types, since I
usually want algorithms or components to work out-of-the-box with
containers.
If I put some requirements on type T for my algorithm A, and I can express
how A should behave if T is a container, then T::value_type must fulfill the
requirement and I can specialize the the algorithm for this case. Mostly I
provide specializations for boost::variant and boost::fusion sequences, but
STL contains a too big set of containers to specialize each and every one.
Does it make any sense?
Regards,
Christian
On 15/05/07, Hervé Brönnimann <hervebronnimann_at_[hidden]> wrote:
>
>
> On May 10, 2007, at 6:56 AM, Christian Holmquist wrote:
> > I've had much use of a small traits class for identifying types
> > that matches
> > the STL Container concept (roughly) .
>
> May I ask why, or in what situation?  I am reminded of Item 2 of
> Meyers "Beware the Illusion of Container-Independent Code". .
> --
> Hervé Brönnimann
> CIS, Polytechnic University
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

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