added fully defined templates for std containers

* updated containers for: vector, map, and list to use fully defined
  template parameters as per the std lib.
This commit is contained in:
theNerd247 2016-07-07 11:31:32 -04:00
parent 728e26e426
commit d0075166ec

View File

@ -161,17 +161,17 @@ struct convert<bool> {
};
// std::map
template <typename K, typename V>
struct convert<std::map<K, V> > {
static Node encode(const std::map<K, V>& rhs) {
template <typename K, typename V, typename C, typename A>
struct convert<std::map<K,V,C,A> > {
static Node encode(const std::map<K,V,C,A>& rhs) {
Node node(NodeType::Map);
for (typename std::map<K, V>::const_iterator it = rhs.begin();
for (typename std::map<K,V,C,A>::const_iterator it = rhs.begin();
it != rhs.end(); ++it)
node.force_insert(it->first, it->second);
return node;
}
static bool decode(const Node& node, std::map<K, V>& rhs) {
static bool decode(const Node& node, std::map<K,V,C,A>& rhs) {
if (!node.IsMap())
return false;
@ -188,17 +188,17 @@ struct convert<std::map<K, V> > {
};
// std::vector
template <typename T>
struct convert<std::vector<T> > {
static Node encode(const std::vector<T>& rhs) {
template <typename T, typename A>
struct convert<std::vector<T,A> > {
static Node encode(const std::vector<T,A>& rhs) {
Node node(NodeType::Sequence);
for (typename std::vector<T>::const_iterator it = rhs.begin();
for (typename std::vector<T,A>::const_iterator it = rhs.begin();
it != rhs.end(); ++it)
node.push_back(*it);
return node;
}
static bool decode(const Node& node, std::vector<T>& rhs) {
static bool decode(const Node& node, std::vector<T,A>& rhs) {
if (!node.IsSequence())
return false;
@ -215,17 +215,17 @@ struct convert<std::vector<T> > {
};
// std::list
template <typename T>
struct convert<std::list<T> > {
static Node encode(const std::list<T>& rhs) {
template <typename T, typename A>
struct convert<std::list<T,A> > {
static Node encode(const std::list<T,A>& rhs) {
Node node(NodeType::Sequence);
for (typename std::list<T>::const_iterator it = rhs.begin();
for (typename std::list<T,A>::const_iterator it = rhs.begin();
it != rhs.end(); ++it)
node.push_back(*it);
return node;
}
static bool decode(const Node& node, std::list<T>& rhs) {
static bool decode(const Node& node, std::list<T,A>& rhs) {
if (!node.IsSequence())
return false;