Equivalent to python's set.pop() for C++'s unordered sets -
does c++ have equivalent python's set.pop()
? i've been looking @ documentation unordered_set
s here, there doesn't seem way 1. access arbitrary element, and/or 2. access + remove arbitrary element (popping).
note c++ standard library intentionally designed various container specifications not include "get , remove" function: e.g. vector
, have back()
returns value @ end, , have pop_back()
removes value @ end, not return it.
the reasons content of separate question.
so want method obtain element (e.g. begin()
suggested in comments), , remove once you've gotten (e.g. erase(iterator)
mentioned in other answer).
Comments
Post a Comment