stlnode.h
Go to the documentation of this file.
00001 #ifndef STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00002 #define STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00003 
00004 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
00005 #pragma once
00006 #endif
00007 
00008 
00009 #include <vector>
00010 #include <map>
00011 
00012 namespace YAML_PM
00013 {
00014         template <typename T>
00015         void operator >> (const Node& node, std::vector<T>& v)
00016         {
00017                 v.clear();
00018                 v.resize(node.size());
00019                 for(unsigned i=0;i<node.size();++i)
00020                         node[i] >> v[i];
00021         }
00022         
00023         
00024         template <typename K, typename V>
00025         void operator >> (const Node& node, std::map<K, V>& m)
00026         {
00027                 m.clear();
00028                 for(Iterator it=node.begin();it!=node.end();++it) {
00029                         K k;
00030                         V v;
00031                         it.first() >> k;
00032                         it.second() >> v;
00033                         m[k] = v;
00034                 }
00035         }
00036 }
00037 
00038 #endif // STLNODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66


upstream_src
Author(s):
autogenerated on Mon Oct 6 2014 10:27:42