I ran into this question today and thought I should post it for the community's reference and/or opinions.
The standard C++ containers vector, deque, list, and string provide an assign
member function. There are two versions; I'm primarily interested in the one accepting an iterator range. The Josuttis book is a little ambiguous with its description. From p. 237...
Assigns all elements of the range [beg,end); this is, is replaces all existing elements with copies of the elements of [beg,end).
It doesn't say what happens if the size of the assignee container is different from the range being assigned. Does it truncate? Does it automagically expand? Is it undefined behavior?