Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2007-05-24 09:53:07

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).


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