How to use of set::insert safely and efficiently #1111
Unanswered
positron96
asked this question in
Q&A
Replies: 1 comment
-
I have a plan to look at this issue at some time. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As I see from documentation and code, just calling
set::insert
can result in undefined behavior:So to have a defined behavior when inserting something, I need to use something similar to this snippet:
But internals for
insert
method will do checks forfull
andfind
again.Is there a way to insert values without these double checks? (with exceptions and asserts turned off, which it seems is the default setting)
I think the question also applies to map and unordered variants.
Beta Was this translation helpful? Give feedback.
All reactions