unordered_map for locale, and const functions where possible

This commit is contained in:
Twan van Laarhoven
2020-09-27 21:53:42 +02:00
parent 7725156225
commit 5b0979f58e
4 changed files with 29 additions and 12 deletions
+11 -3
View File
@@ -57,6 +57,7 @@ public:
template <typename T> void handle(const intrusive_ptr<T>&);
/// Write a map to the output stream
template <typename K, typename V> void handle(const map<K,V>&);
template <typename K, typename V> void handle(const unordered_map<K, V>&);
/// Write an IndexMap to the output stream
template <typename K, typename V> void handle(const IndexMap<K,V>&);
template <typename K, typename V> void handle(const DelayedIndexMaps<K,V>&);
@@ -111,15 +112,22 @@ void Writer::handle(const intrusive_ptr<T>& pointer) {
}
template <typename K, typename V>
void Writer::handle(const map<K,V>& m) {
for (typename map<K,V>::const_iterator it = m.begin() ; it != m.end() ; ++it) {
void Writer::handle(const map<K, V>& m) {
for (auto it = m.begin(); it != m.end(); ++it) {
handle(it->first.c_str(), it->second);
}
}
template <typename K, typename V>
void Writer::handle(const unordered_map<K, V>& m) {
for (auto it = m.begin(); it != m.end(); ++it) {
handle(it->first.c_str(), it->second);
}
}
template <typename K, typename V>
void Writer::handle(const IndexMap<K,V>& m) {
for (typename IndexMap<K,V>::const_iterator it = m.begin() ; it != m.end() ; ++it) {
for (auto it = m.begin() ; it != m.end() ; ++it) {
handle(get_key_name(*it).c_str(), *it);
}
}