aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_map.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-12-09 11:29:28 +0000
committergingerBill <bill@gingerbill.org>2022-12-09 11:29:28 +0000
commit34a048f7daaf93b16ae4121bf5238f9008f3465b (patch)
tree3857fdc80f73522a8b2af265f257a4decd447afd /src/ptr_map.cpp
parentffe953b43d1ad31d2c37f544a1d389e30d8f69bf (diff)
Replace compiler for loops for the hash-table types to simplify code usage
Diffstat (limited to 'src/ptr_map.cpp')
-rw-r--r--src/ptr_map.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ptr_map.cpp b/src/ptr_map.cpp
index 43e793b8a..ed4b20bf8 100644
--- a/src/ptr_map.cpp
+++ b/src/ptr_map.cpp
@@ -339,3 +339,24 @@ void multi_map_remove_all(PtrMap<K, V> *h, K key) {
}
}
#endif
+
+
+template <typename K, typename V>
+PtrMapEntry<K, V> *begin(PtrMap<K, V> &m) {
+ return m.entries.data;
+}
+template <typename K, typename V>
+PtrMapEntry<K, V> const *begin(PtrMap<K, V> const &m) {
+ return m.entries.data;
+}
+
+
+template <typename K, typename V>
+PtrMapEntry<K, V> *end(PtrMap<K, V> &m) {
+ return m.entries.data + m.entries.count;
+}
+
+template <typename K, typename V>
+PtrMapEntry<K, V> const *end(PtrMap<K, V> const &m) {
+ return m.entries.data + m.entries.count;
+}