Switched the implementation of maps from list<pair> to map (but just pointer comparison)

This commit is contained in:
beder
2011-09-11 16:56:38 -05:00
parent ad28ffc6f8
commit 9c6bd61398
4 changed files with 7 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ namespace YAML
node& k = convert_to_node(key, pMemory);
node& v = pMemory->create_node();
m_map.push_back(kv_pair(&k, &v));
m_map[&k] = &v;
return v;
}

View File

@@ -86,8 +86,7 @@ namespace YAML
mutable std::size_t m_seqSize;
// map
typedef std::pair<node *, node *> kv_pair;
typedef std::list<kv_pair> node_map;
typedef std::map<node *, node *> node_map;
node_map m_map;
};
}

View File

@@ -10,7 +10,7 @@
#include "yaml-cpp/node/ptr.h"
#include <boost/iterator/iterator_facade.hpp>
#include <boost/utility/enable_if.hpp>
#include <list>
#include <map>
#include <utility>
#include <vector>
@@ -35,8 +35,7 @@ namespace YAML
};
typedef std::vector<node *> node_seq;
typedef std::pair<node *, node *> kv_pair;
typedef std::list<kv_pair> node_map;
typedef std::map<node *, node *> node_map;
template<typename V>
struct node_iterator_type {