示例#1
0
unsigned string_containert::get(const std::string &s)
{
  string_ptrt string_ptr(s);

  hash_tablet::iterator it = hash_table.find(string_ptr);

  if(it != hash_table.end())
    return it->second;

  unsigned r = hash_table.size();

  // these are stable
  string_list.push_back(s);
  string_ptrt result(string_list.back());

  hash_table[result] = r;

  // these are not
  string_vector.push_back(&string_list.back());

  return r;
}
示例#2
0
	    const string_ptr MaxValue::toString() {
		return string_ptr(new string(_toString(bit) + "bit"));
	    };