C++ Logo


Advanced search

Thoughts on making unchecked_emplace_back a public function for vector?

From: Alex <orangechicken_at_[hidden]>
Date: Mon, 11 Oct 2021 05:52:43 -0700
I've been playing around with a slightly modified version of the
standard vector header for a while now which makes
"unchecked_emplace_back" a usable function as well as some other utility
functions I've added. There's more than a few cases I've had so far to
use it and net a bit of a bonus bit of performance.

Rough idea is a function (or functions) which assumes a bit more
responsibility on the side of the user, but it short cuts some redundant
checks on the containers capacity. In playing around I actually found a
different way to go about this which was way faster, however I think it
might be a stretch because it would pretty much allow full access over
all the vector's members.

The only thing I'm really wondering is whether this is the right email
to send this to, some places suggested floating standards proposals
here, wasn't exactly clear. In any case, thoughts? The edits for
reference to existing headers are extremely minor, usually because an
unchecked version of emplace_back is already written as a utility
function for emplace_back to work. I also have zero reference for
whether this has been brought up before.

-Alex Anderson

Received on 2021-10-11 07:52:49