jbrandmeyer at earthlink.net
Thu Jul 8 18:32:41 CEST 2004
On Tue, 2004-07-06 at 20:49, Ralf W. Grosse-Kunstleve wrote:
> Other general feedback (not urgent by any means):
> double partial_sum(std::vector<double> const& Foo, slice index)
> I tried
> double partial_sum(std::vector<double> const& Foo, slice const& index)
> but it did not work, which I found surprising.
That's because the start() stop() and step() member functions (and, by
extension, get_indicies()) were not const. They should be and I will
make that change.
> I couldn't figure out how to get the size of the final array from a slice
> instance without looping over all indices. This would be useful for e.g.
Since ret.stop is guaranteed to be a multiple of ret.step away from
ret.start, this statement should get it for you (the signs also work out
in the reverse case):
int size = (ret.stop - ret.start) / ret.step;
More information about the Cplusplus-sig