|
Boost : |
From: Bernard HUGUENEY (bernard.hugueney_at_[hidden])
Date: 2000-07-19 11:08:34
Hi,
I am an enthusiast user of LL ( pretty hard for me to get used to such simplicity compared to the clumsy std:: !!! ) and
GGCL and have always been tired of using temporary tuples of ranges of iterators.
I use a kind of Collection-like interface with collection_traits<> specialized for tuples and pair, default been for
Containers. As I was always more than happy to thrash much of my home-brewed code for some code from the
vault ( one day, oh yes, one day I will be able to contribute back :-) ), I wondered weither it could be standartized, or
is it plain ugly ?
example:
instead of
... boring declaration of verticesBegin and verticesEnd
tie(verticesBegin, verticesEnd) = vertices(g);// or something else
for_each( verticesBegin, verticesEnd, do_something(free1));
we could have just
for_each( vertices(g), do_something(free1));
with
template<typename CollectionType, typename Op>
Op for_each( const CollectionType & c, Op o){
return for_each( collection_traits< CollectionType >::begin(c),
collection_traits<CollectionType>::end(c),
o);
}
Bernard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk