On Sat, Oct 3, 2009 at 2:31 AM, Joseph A. Marrero <[email protected]> wrote: > Why do the various insertion members (insert, push_back, etc...) in the STL > containers take a parameter as input if they will eventually be placed on the > heap? Isn't this a limitation since you first usually have to create an > automatic variable, initialize it, and copy it to the heap? Wouldn't it have > been more efficient to just allow the caller to initialize it directly on the > heap (as done typically in C data structures)?
If you have performance issues because of this, then why don't you store pointers in your vector? That way you'll be in control of the construction and destruction of your objects. -- Tamas Marki
