mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Switched the implementation of maps from list<pair> to map (but just pointer comparison)
This commit is contained in:
@@ -54,7 +54,7 @@ namespace YAML
|
|||||||
|
|
||||||
node& k = convert_to_node(key, pMemory);
|
node& k = convert_to_node(key, pMemory);
|
||||||
node& v = pMemory->create_node();
|
node& v = pMemory->create_node();
|
||||||
m_map.push_back(kv_pair(&k, &v));
|
m_map[&k] = &v;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,8 +86,7 @@ namespace YAML
|
|||||||
mutable std::size_t m_seqSize;
|
mutable std::size_t m_seqSize;
|
||||||
|
|
||||||
// map
|
// map
|
||||||
typedef std::pair<node *, node *> kv_pair;
|
typedef std::map<node *, node *> node_map;
|
||||||
typedef std::list<kv_pair> node_map;
|
|
||||||
node_map m_map;
|
node_map m_map;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "yaml-cpp/node/ptr.h"
|
#include "yaml-cpp/node/ptr.h"
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#include <boost/utility/enable_if.hpp>
|
#include <boost/utility/enable_if.hpp>
|
||||||
#include <list>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -35,8 +35,7 @@ namespace YAML
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<node *> node_seq;
|
typedef std::vector<node *> node_seq;
|
||||||
typedef std::pair<node *, node *> kv_pair;
|
typedef std::map<node *, node *> node_map;
|
||||||
typedef std::list<kv_pair> node_map;
|
|
||||||
|
|
||||||
template<typename V>
|
template<typename V>
|
||||||
struct node_iterator_type {
|
struct node_iterator_type {
|
||||||
|
@@ -166,7 +166,7 @@ namespace YAML
|
|||||||
if(m_type != NodeType::Map)
|
if(m_type != NodeType::Map)
|
||||||
throw std::runtime_error("Can't insert into a non-map node");
|
throw std::runtime_error("Can't insert into a non-map node");
|
||||||
|
|
||||||
m_map.push_back(kv_pair(&key, &value));
|
m_map[&key] = &value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexing
|
// indexing
|
||||||
@@ -205,7 +205,7 @@ namespace YAML
|
|||||||
}
|
}
|
||||||
|
|
||||||
node& value = pMemory->create_node();
|
node& value = pMemory->create_node();
|
||||||
m_map.push_back(kv_pair(&key, &value));
|
m_map[&key] = &value;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ namespace YAML
|
|||||||
|
|
||||||
node& key = pMemory->create_node();
|
node& key = pMemory->create_node();
|
||||||
key.set_scalar(stream.str());
|
key.set_scalar(stream.str());
|
||||||
m_map.push_back(kv_pair(&key, m_sequence[i]));
|
m_map[&key] = m_sequence[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_sequence();
|
reset_sequence();
|
||||||
|
Reference in New Issue
Block a user