diff options
Diffstat (limited to 'Examples/python/std_map/example.h')
-rw-r--r-- | Examples/python/std_map/example.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Examples/python/std_map/example.h b/Examples/python/std_map/example.h new file mode 100644 index 0000000..79ccc64 --- /dev/null +++ b/Examples/python/std_map/example.h @@ -0,0 +1,17 @@ +/* File : example.h */ + +#include <map> +#include <string> + +template<class Key, class Value> +std::map<Key,Value> half_map(const std::map<Key,Value>& v) { + typedef typename std::map<Key,Value>::const_iterator iter; + std::map<Key,Value> w; + for (iter i = v.begin(); i != v.end(); ++i) { + w[i->first] = (i->second)/2; + } + return w; +} + + + |