本文整理汇总了C++中MultiMap::findEqual方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiMap::findEqual方法的具体用法?C++ MultiMap::findEqual怎么用?C++ MultiMap::findEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiMap
的用法示例。
在下文中一共展示了MultiMap::findEqual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
/*Database db;
db.loadFromURL("http://cs.ucla.edu/classes/winter14/cs32/Projects/4/Data/census.csv");
*/
MultiMap m;
m.insert("D", 8);
m.insert("B", 4);
m.insert("F", 12);
m.insert("A", 1);
m.insert("C", 5);
m.insert("E", 9);
m.insert("G", 13);
m.insert("A", 2);
m.insert("C", 6);
m.insert("E", 10);
m.insert("G", 14);
m.insert("A", 3);
m.insert("C", 7);
m.insert("E", 11);
m.insert("G", 15);
MultiMap::Iterator c(m.findEqual("D"));
assert(c.valid());
MultiMap::Iterator d;
for (; c.valid(); c.prev())
d = c;
for (; d.valid(); d.next())
cout << d.getKey() << " " << d.getValue() << endl;
cout << endl;
MultiMap::Iterator a(m.findEqual("D"));
assert(a.valid());
MultiMap::Iterator b;
for (; a.valid(); a.next())
b = a;
for (; b.valid(); b.prev())
cout << b.getKey() << " " << b.getValue() << endl;
MultiMap::Iterator t;
t = m.findEqual("A");
if (t.valid())
{
cout << endl;
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
}
t = m.findEqualOrSuccessor("Fz");
if (t.valid())
{
cout << endl;
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
}
t = m.findEqualOrPredecessor("E");
t.next();
MultiMap::Iterator after = t;
t.next();
MultiMap::Iterator afterafter = t;
t.prev();
t.prev();
if (t.valid() && after.valid() && afterafter.valid())
{
cout << endl;
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
t.next();
cout << t.getKey() << " " << t.getValue() << endl;
}
Database database;
Database::FieldDescriptor fd1, fd2, fd3;
fd1.name = "username";
fd1.index = Database::it_indexed; // username is an indexed field
fd2.name = "phonenum";
fd2.index = Database::it_indexed; // phone # is an indexed field
fd3.name = "age";
fd3.index = Database::it_none; // age is NOT an indexed field
std::vector<Database::FieldDescriptor> schema;
schema.push_back(fd1);
schema.push_back(fd2);
schema.push_back(fd3);
database.specifySchema(schema);
vector<string> row;
string username = "Jasoniful";
//.........这里部分代码省略.........