Boost logo

Boost :

From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2007-05-24 10:31:41


> Yes and no. Container traits could be useful with container operations
> like insert, not for outputting a range of values (Boost.Range is more
> generic here).

Can I determine from a type T if it is a range, or if I can construct a
range from it?
I remember looking for something like this but couldn't find it.

On 24/05/07, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
>
> Christian Holmquist skrev:
> >> 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?
>
> Yes and no. Container traits could be useful with container operations
> like insert, not for outputting a range of values (Boost.Range is more
> generic here).
>
> -Thorsten
> _______________________________________________
> 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