Topic: std::partial_sum


Author: V.Haisman@sh.cvut.cz ("Vaclav Haisman")
Date: Tue, 24 May 2005 17:54:44 GMT
Raw View
I think that the STD should have one more variant of parial_sum which would
look like this:

template <class InputIterator, class OutputIterator, class BinaryOperation>
OutputIterator
partial_sum (InputIterator first, InputIterator last,
             OutputIterator result, BinaryOperation binary_op,
             typename iterator_traits<OutputIterator>::value_type init);

Where init would be inital value of the partial sum. Why? Because it would
allow me to do partial_sum over input collection that stores structures that
are not convertible to value_type with output to collection that stores
value_type.


VH



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]