本文整理汇总了C++中stringset类的典型用法代码示例。如果您正苦于以下问题:C++ stringset类的具体用法?C++ stringset怎么用?C++ stringset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了stringset类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dump_stringset
void dump_stringset (FILE* out) {
size_t max_bucket_size = 0;
for (size_t bucket = 0; bucket < set.bucket_count(); ++bucket) {
bool need_index = true;
size_t curr_size = set.bucket_size (bucket);
if (max_bucket_size < curr_size) max_bucket_size = curr_size;
for (stringset::const_local_iterator itor = set.cbegin (bucket);
itor != set.cend (bucket); ++itor) {
if (need_index) fprintf (out, "stringset[%4lu]: ", bucket);
else fprintf (out, " %4s ", "");
need_index = false;
const string* str = &*itor;
fprintf (out, "%22lu %p->\"%s\"\n",
set.hash_function()(*str),
str, str->c_str());
}
}
fprintf (out, "load_factor = %.3f\n", set.load_factor());
fprintf (out, "bucket_count = %lu\n", set.bucket_count());
fprintf (out, "max_bucket_size = %lu\n", max_bucket_size);
}
开发者ID:raychung02,项目名称:coursework,代码行数:21,代码来源:stringset.cpp
示例2: dump_stringset
void dump_stringset (ostream& out) {
size_t max_bucket_size = 0;
for (size_t bucket = 0; bucket < set.bucket_count(); ++bucket) {
bool need_index = true;
size_t curr_size = set.bucket_size (bucket);
if (max_bucket_size < curr_size) max_bucket_size = curr_size;
for (stringset::const_local_iterator itor = set.cbegin (bucket);itor != set.cend (bucket); ++itor) {
if (need_index)
out << "stringset[" << setw(4) << bucket<< "]: ";
else
out << setw(17) << "";
need_index = false;
const string* str = &*itor;
out << setw(22) << set.hash_function()(*str) << ": "<< str << "->\"" << *str << "\"" << endl;
}
}
out << "load_factor = " << fixed << setprecision(3)
<< set.load_factor() << endl;
out << "bucket_count = " << set.bucket_count() << endl;
out << "max_bucket_size = " << max_bucket_size << endl;
}
开发者ID:chsu16,项目名称:BNF-Compiler,代码行数:21,代码来源:stringset.cpp
示例3: intern_stringset
const string* intern_stringset (const char* string) {
pair<stringset::const_iterator,bool> handle = set.insert (string);
return &*handle.first;
}
开发者ID:loug38,项目名称:Abstract-Syntax-Tree-for-OC-Compiler,代码行数:4,代码来源:stringset.cpp
注:本文中的stringset类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论