sparse_hash_mapを使う

http://google-sparsehash.googlecode.com/
APIは普通のMapと変わらない感じ。

#include <iostream>
#include <google/sparse_hash_map>

using namespace std;
using namespace google;

int main() {
  typedef sparse_hash_map<const char *, const char *> cmap;
  cmap m;

  m["foo"] = "hoge";
  m["bar"] = "piyo";
  m["zoo"] = "fuga";

  for(cmap::iterator i = m.begin(); i != m.end(); i++) {
    cout << i->first << "=" << i->second << endl;
  }

  return 0;
}