mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 01:14:40 +00:00
Replace compiler for loops for the hash-table types to simplify code usage
This commit is contained in:
@@ -30,6 +30,8 @@ struct StringMapEntry {
|
||||
|
||||
template <typename T>
|
||||
struct StringMap {
|
||||
using K = String;
|
||||
using V = T;
|
||||
Slice<MapIndex> hashes;
|
||||
Array<StringMapEntry<T> > entries;
|
||||
};
|
||||
@@ -270,3 +272,24 @@ gb_inline void string_map_clear(StringMap<T> *h) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
StringMapEntry<T> *begin(StringMap<T> &m) {
|
||||
return m.entries.data;
|
||||
}
|
||||
template <typename T>
|
||||
StringMapEntry<T> const *begin(StringMap<T> const &m) {
|
||||
return m.entries.data;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
StringMapEntry<T> *end(StringMap<T> &m) {
|
||||
return m.entries.data + m.entries.count;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
StringMapEntry<T> const *end(StringMap<T> const &m) {
|
||||
return m.entries.data + m.entries.count;
|
||||
}
|
||||
Reference in New Issue
Block a user