Skip to content

Commit 6facf74

Browse files
committed
Map wrappers: forward more of the std::map interface
This remains incomplete, forwarding as per users' needs rather than forwarding the entire std::map interface, hopefully splitting the difference between providing useful functionality and preserving the possibility to switch out different types without undue difficulty.
1 parent c125146 commit 6facf74

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/pointer-analysis/value_set.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class value_sett
7070
typedef data_typet::const_iterator const_iterator;
7171
// NOLINTNEXTLINE(readability/identifiers)
7272
typedef data_typet::value_type value_type;
73+
// NOLINTNEXTLINE(readability/identifiers)
74+
typedef data_typet::key_type key_type;
7375

7476
iterator begin() { return data.begin(); }
7577
const_iterator begin() const { return data.begin(); }
@@ -82,7 +84,12 @@ class value_sett
8284
size_t size() const { return data.size(); }
8385
bool empty() const { return data.empty(); }
8486

85-
objectt &operator[](unsigned i) { return data[i]; }
87+
void erase(key_type i) { data.erase(i); }
88+
void erase(const_iterator it) { data.erase(it); }
89+
90+
objectt &operator[](key_type i) { return data[i]; }
91+
objectt &at(key_type i) { return data.at(i); }
92+
const objectt &at(key_type i) const { return data.at(i); }
8693

8794
template <typename It>
8895
void insert(It b, It e) { data.insert(b, e); }

src/util/numbering.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ class hash_numbering final
152152
T &operator[](size_type t) { return data[t]; }
153153
const T &operator[](size_type t) const { return data[t]; }
154154

155+
T &at(size_type t) { return data.at(t); }
156+
const T &at(size_type t) const { return data.at(t); }
157+
155158
size_type size() const { return data.size(); }
156159

157160
iterator begin() { return data.begin(); }

0 commit comments

Comments
 (0)