mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
add some util functions to gd map :map:
This commit is contained in:
parent
d165616700
commit
e4ab8819f5
1 changed files with 22 additions and 0 deletions
|
@ -194,6 +194,24 @@ namespace gd {
|
|||
return (*__i).second;
|
||||
}
|
||||
|
||||
V& at(K const& __k) {
|
||||
iterator __i = lower_bound(__k);
|
||||
if (__i == end() || compare(__k, (*__i).first)) {
|
||||
throw std::out_of_range("map::at");
|
||||
}
|
||||
|
||||
return (*__i).second;
|
||||
}
|
||||
|
||||
const V& at(K const& __k) const {
|
||||
iterator __i = lower_bound(__k);
|
||||
if (__i == end() || compare(__k, (*__i).first)) {
|
||||
throw std::out_of_range("map::at");
|
||||
}
|
||||
|
||||
return (*__i).second;
|
||||
}
|
||||
|
||||
iterator begin() noexcept {
|
||||
return iterator(m_header.m_left);
|
||||
}
|
||||
|
@ -249,6 +267,10 @@ namespace gd {
|
|||
return find(__x) != end() ? 1 : 0;
|
||||
}
|
||||
|
||||
bool contains(K const& __x) {
|
||||
return count() > 0;
|
||||
}
|
||||
|
||||
map(map const& lol) : map(std::map<K, V>(lol)) {}
|
||||
|
||||
map() : map(std::map<K, V>()) {}
|
||||
|
|
Loading…
Reference in a new issue