Re: Is there an STL algo to fill a vector with product of 2 other
vectors?
On Dec 10, 12:16 am, Pete Becker <p...@versatilecoding.com> wrote:
On 2008-12-09 17:28:15 -0500, Steve555 <foursh...@btinternet.com> said:
(OK, it's not so much trouble to add it, but it does seem
like adding the redundant instruction DontCrash() ;) )
It's not redundant.
STL algorithms write their output to sequences. An output
sequence is designated by a single iterator. If that iterator
points to the beginning of a vector or an array you can write
onto the elements of the vector without having to change its
size, provided it's at least as large as the number of things
you're going to write. But the iterator can also be an insert
iterator, in which case it inserts new elements into a
container.
And not to forget: there are three different types of insertion
iterator. I could have just as easily used front_inserter, or
inserter, with an additional iterator argument specifying where
I wanted to insert.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34