emplace_back vs push_back #18100
Replies: 2 comments 15 replies
-
|
I worry we're asking the wrong question here. The above tells me VisIt is a Its what we've always used and what I think we should continue to use...that is unless there is some kind of a real issue Don't get me wrong. I value innovation and I want to encourage adoption of new practices. But, IMHO, those new practices need have a reason for being introduced. They need to solve a credible problem. New for the sake of new is not useful. Maybe its shinny. Maybe its modern. Maybe its keeping up with newer language standards. But, IMHO, none of that is relevant if it is not solving a problem. In the few cases were Were the objects in the cases The three options you offered actually don't cover what I am proposing here so I'll propose a 4th option for your list...
|
Beta Was this translation helpful? Give feedback.
-
|
It looks like the current If you weren't aware -- For this case, since https://stackoverflow.com/questions/44971360/stdvectorboolemplace-in-c11 I don't see the exact mention of missing support alluded to on the current cppref (I think the page changed since the stack overflow post was made), but I believe this is why Justin's reasonable attempt was blocked by evil. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Should we be using
emplace_backorpush_backfor adding items to vectors? For other containers,emplace_backcan be slower than regular insertion, but for vectors it is faster.Should we
push_backand replace them withemplace_back?emplace_backgoing forward and replace instances of vectorpush_backwhen we encounter them?emplace_backat all. 😢Beta Was this translation helpful? Give feedback.
All reactions