Topic: copy_n


Author: "Ed Brey" <brey@afd.mke.etn.com>
Date: 1999/11/05
Raw View
std::fill has a companion function std::fill_n, which replaces the "last"
iterator with a size "n".  Likewise, std::generate has a similar companion
that also takes a single output iterator instead of a pair of forward
iterators.

Why don't functions that take input iterators also have _n companions that
replace the "last" input iterator with a size "n"?  An example might be
std::copy_n(InIt first, Size n, OutIt result).

I checked "The C++ Programming Language", 3rd edition, but couldn't find any
rationale.




[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]