Expanding the list of "Hardened Packages"

Ben Boeckel mathstuf at gmail.com
Fri May 17 05:17:31 UTC 2013

While we're dredging up old threads ;) .

On Fri, 10 May, 2013 at 12:29:16 GMT, Florian Weimer wrote:
> There is some fairly horrible stuff, like std::copy:
> You can pass a std::vector<T>::iterator (say, the result of begin()) as 
> the output iterator, but it's your job to ensure that there's enough 
> space.  Just like strcpy, and we all know how well that worked in practice.

Well, the STL has a solution for that, but the header is, unfortunately,
underused IME.

    #include <iterator>

    std::copy(src.begin(), src.end(), std::back_inserter(dest));

That said, I do wish there were a "InsertIterator" concept or the like
which std::copy would require (and probably move the existing std::copy
to std::unsafe_copy if it's deemed required still).


More information about the devel mailing list