|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-05-18 16:48:42
Hi,
Oven, an implementation of the Range Library Proposal, was uploaded to Vault/Algorithms.
I suppose it is considered as Boost.View2 or range_ex2.
The file:
http://tinyurl.com/2axp2l
Range Library Proposal:
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1871.html
An example "lazy merge sort":
typedef
any_range<int const&, boost::forward_traversal_tag>
range;
range merge_sort(range rng)
{
typedef boost::result_of<op_distance(range&)>::type diff_t;
diff_t d = distance(rng);
if (d < 2)
return rng;
else {
return make_merged(
merge_sort(rng|taken(d/2)),
merge_sort(rng|dropped(d/2))
);
}
}
The status is highly preliminary, but moderately tested.
Any feedback appreciated.
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk