29 using key_type =
typename UnorderedSetType::key_type;
30 using value_type =
typename UnorderedSetType::value_type;
31 using size_type =
typename UnorderedSetType::size_type;
32 using const_iterator =
typename UnorderedSetType::const_iterator;
39 using Action = std::tuple<ActionKind, Key>;
53 const_iterator
begin()
const {
return set_.begin(); }
54 const_iterator cbegin()
const {
return set_.cbegin(); }
55 const_iterator end()
const {
return set_.end(); }
56 const_iterator cend()
const {
return set_.cend(); }
59 bool empty()
const {
return set_.empty(); }
60 size_type size()
const {
return set_.size(); }
68 void insert(
const Key &k) {
69 auto it = set_.find(k);
70 if (it == set_.end()) {
77 size_type count(
const Key &key)
const {
return set_.count(key); }
79 const_iterator
find(
const Key &key)
const {
return set_.find(key); }
82 void push() { stack_.push_back(actions_.size()); }
85 throw std::runtime_error(
"ScopedUnorderedSet cannot be popped because it's scope is empty.");
87 size_type idx = stack_.back();
88 while (idx < actions_.size()) {
89 const Action &item{actions_.back()};
91 const Key &k{std::get<1>(item)};
92 auto it = set_.find(k);
105 std::vector<Action> actions_;
106 std::vector<size_type> stack_;