PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/python/std_map/example.h

#
C++ Header | 17 lines | 11 code | 5 blank | 1 comment | 2 complexity | a06d443aa0e48a59d85b6d321b1d56eb MD5 | raw file
 1/* File : example.h */
 2
 3#include <map>
 4#include <string>
 5
 6template<class Key, class Value>
 7std::map<Key,Value> half_map(const std::map<Key,Value>& v) {
 8  typedef typename std::map<Key,Value>::const_iterator iter;  
 9  std::map<Key,Value> w;
10  for (iter i = v.begin(); i != v.end(); ++i) {
11    w[i->first] = (i->second)/2;
12  }  
13  return w;
14}
15
16
17