|
Boost : |
From: Richard Peters (r.a.peters_at_[hidden])
Date: 2004-11-10 03:42:09
In algo.hpp, I see the following code:
// template<class fwd_it, class out_it> out_it
// rotate_copy(fwd_it first, fwd_it middle, fwd_it last, out_it result);
template<class r, class fwd_it, class out_it> inline out_it
rotate_coy(const r& val1, fwd_it val2, out_it val3) {
return ::std::rotate_coy( val1.begin(), val1.end(), val2, val3 );
}
template<class r, class fwd_it, class out_it> inline out_it
rotate_coy(r& val1, fwd_it val2, out_it val3) {
return ::std::rotate_coy( val1.begin(), val1.end(), val2, val3 );
}
I would expect the range version of rotate_copy to take as first parameter a
range, and as second parameter an iterator pointing to an element inside
that range. The iterator version takes its iterators as first, middle, last.
I think it is more intuitively to see [first, last) as the range, where
middle is pointing into, instead of seeing [first, middle) as a range,
augmented by a last iterator. You'd probably want to call this function as
rotate_copy(container, container.begin() + 5, ...). With the current
version, the first parameter probably always has to be crafted by hand, like
rotate_copy(crange<container_type>(container.begin(), container.begin() +
5), container.end(), ...).
best regards,
Richard Peters
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk