本文整理汇总了C++中VectorMap::GetKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorMap::GetKeys方法的具体用法?C++ VectorMap::GetKeys怎么用?C++ VectorMap::GetKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorMap
的用法示例。
在下文中一共展示了VectorMap::GetKeys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BenchNTL2
void BenchNTL2(const char *file, Stream& out) {
FileIn in(file);
if (!in) {
out << "Cannot open input file.\n";
return;
}
VectorMap<String, int> map;
for(;;) {
int c = in.Get();
if(c < 0) break;
if(IsAlpha(c) || c == '_') {
String id;
id.Cat(c);
c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '_')) {
id.Cat(c);
c = in.Get();
}
map.GetAdd(id, 0)++;
}
else
if(IsDigit(c))
do c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '.'));
}
Vector<int> order = GetSortOrder(map.GetKeys());
for(int i = 0; i < order.GetCount(); i++)
out << ~map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
}
示例2: Scores
void Puzzle::Scores()
{
WithScoreLayout<TopWindow> d;
CtrlLayoutOK(d, t_("Best scores"));
d.score.AddColumn(t_("Dimension"));
d.score.AddColumn(t_("Moves"));
d.score.ColumnWidths("71 48");
d.score.NoCursor().NoGrid();
Vector<int> o = GetSortOrder(score.GetKeys());
for(int i = 0; i < o.GetCount(); i++)
d.score.Add(score.GetKey(o[i]), score[o[i]]);
d.Run();
}
示例3: BenchNTL
void BenchNTL(const char *file) {
FileIn in(file);
if (!in) {
std::cout << "Cannot open input file.\n";
return;
}
VectorMap<String, Vector<int> > map;
int line = 1;
for(;;) {
int c = in.Get();
if(c < 0) break;
if(IsAlpha(c) || c == '_') {
String id;
id.Cat(c);
c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '_')) {
id.Cat(c);
c = in.Get();
}
map.GetAdd(id).Add(line);
}
else
if(IsDigit(c))
do c = in.Get();
while(c >= 0 && (IsAlNum(c) || c == '.'));
if(c == '\n')
++line;
}
Vector<int> order = GetSortOrder(map.GetKeys());
#ifndef NO_OUTPUT
for(int i = 0; i < order.GetCount(); i++) {
std::cout << ~map.GetKey(order[i]) << ": ";
const Vector<int>& l = map[order[i]];
for(int i = 0; i < l.GetCount(); i++) {
if(i) std::cout << ", ";
std::cout << l[i];
}
std::cout << '\n';
}
#endif
}
示例4: main
int main(int argc, const char *argv[])
{
int n;
VectorMap<String, int> map;
Cout() << " lines words bytes file\n";
int total_lines = 0;
int total_words = 0;
int total_bytes = 0;
for(int i = 1; i < argc; i++) {
String f = LoadFile(argv[i]);
int lines = 0;
int words = 0;
const char *q = f;
for(;;) {
int c = *q;
if(IsAlpha(c)) {
const char *b = q++;
while(IsAlNum(*q)) q++;
map.GetAdd(String(b, q), 0)++;
words++;
}
else {
if(!c) break;
if(c == '\n')
++lines;
q++;
}
}
Cout() << Format("%8d%8d%8d %s\n", lines, words, f.GetCount(), argv[i]);
total_lines += lines;
total_words += words;
total_bytes += f.GetCount();
}
Vector<int> order = GetSortOrder(map.GetKeys());
#ifndef NOOUTPUT
Cout() << Format("--------------------------------------%8d%8d%8d total\n", total_lines, total_words, total_bytes);
for(int i = 0; i < order.GetCount(); i++)
Cout() << map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
#endif
return 0;
}
示例5: Create
ValueMap::ValueMap(const VectorMap<Value, Value>& m, int deep)
{
Data& d = Create();
d.key = clone(m.GetKeys());
d.value = ValueArray(m.GetValues(), 0);
}