|
-
June 24th, 2010, 11:42 AM
#14
Re: Why does std::vector require its elements to be assignable?
 Originally Posted by HighCommander4
The only operation I can think of that would require the elements to be assignable is the vector's own assignment operator, but why would an operation like push_back() require invoking the assignment operator of its elements? Even in the case of a reallocation, can't the vector use placement new to copy-construct the new elements from the old ones?
Placement new? How is that relevant to the question? The object still has to be copied one way or the other and this is done through either the assignment operator or copy constructor.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|