本文整理汇总了C++中multimap::upper_bound方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::upper_bound方法的具体用法?C++ multimap::upper_bound怎么用?C++ multimap::upper_bound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multimap
的用法示例。
在下文中一共展示了multimap::upper_bound方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printmultimap1
void printmultimap1(multimap <string, string> &authors)
{
typedef multimap <string, string>::iterator iters;
iters iterb = authors.lower_bound("Barth, John");//指向关键字的第一个数据
iters itere = authors.upper_bound("Barth, John");//最后一个的下一个数据
while (iterb!=itere)
{
cout << iterb->first << "--->" << iterb->second << endl;
++iterb;
}
}
示例2:
vector<string> TelephoneDirectory::find_entries(int number)
{
multimap<int, string>::iterator lower
= inverse_database.lower_bound(number);
multimap<int, string>::iterator upper
= inverse_database.upper_bound(number);
vector<string> result;
for (multimap<int, string>::iterator pos = lower;
pos != upper; pos++)
result.push_back(pos->second);
return result;
}
示例3: AlreadyHave
bool AlreadyHave(multimap<string, string> &mulMap,
const pair<string, string> &searchItem)
{
multimap<string, string>::iterator begin = mulMap.lower_bound(searchItem.first);
multimap<string, string>::iterator end = mulMap.upper_bound(searchItem.first);
while(begin != end){
// cout<<begin->second<<begin->first;
if(begin->second == searchItem.second)
return true;
++begin;
}
return false;
}
示例4: traceback
void traceback(int key){
multimap<int,int>::iterator first,last;
printf("%d", key);
first = edge.lower_bound(key);
last = edge.upper_bound(key);
for(;first != last; first++){
printf(" (");
traceback(first->second);
printf(")");
}
}
示例5: processNodes
void CfgToDotImpl::processNodes(SgNode* top) {
if (nodesPrinted.find(top) != nodesPrinted.end()) return;
nodesPrinted.insert(top);
o << "subgraph cluster_" << uintptr_t(top) << " {" << endl;
o << "style=invis;" << endl;
for (multimap<SgNode*, CFGNode>::const_iterator it = exploredNodes.lower_bound(top);
it != exploredNodes.upper_bound(top); ++it) {
printNodePlusEdges(o, it->second);
}
vector<SgNode*> children = top->get_traversalSuccessorContainer();
for (unsigned int i = 0; i < children.size(); ++i) {
if (children[i]) {
processNodes(children[i]);
}
}
o << "}" << endl;
}
示例6: normalize
static CRF_State
crfstate(const vector<Token> &vt, int i)
{
CRF_State sample;
string str = vt[i].str;
// string str = normalize(vt[i].str);
sample.label = vt[i].pos;
sample.add_feature("W0_" + vt[i].str);
sample.add_feature("NW0_" + normalize(str));
string prestr = "BOS";
if (i > 0) prestr = vt[i-1].str;
// if (i > 0) prestr = normalize(vt[i-1].str);
string prestr2 = "BOS";
if (i > 1) prestr2 = vt[i-2].str;
// if (i > 1) prestr2 = normalize(vt[i-2].str);
string poststr = "EOS";
if (i < (int)vt.size()-1) poststr = vt[i+1].str;
// if (i < (int)vt.size()-1) poststr = normalize(vt[i+1].str);
string poststr2 = "EOS";
if (i < (int)vt.size()-2) poststr2 = vt[i+2].str;
// if (i < (int)vt.size()-2) poststr2 = normalize(vt[i+2].str);
sample.add_feature("W-1_" + prestr);
sample.add_feature("W+1_" + poststr);
sample.add_feature("W-2_" + prestr2);
sample.add_feature("W+2_" + poststr2);
sample.add_feature("W-10_" + prestr + "_" + str);
sample.add_feature("W0+1_" + str + "_" + poststr);
sample.add_feature("W-1+1_" + prestr + "_" + poststr);
//sample.add_feature("W-10+1_" + prestr + "_" + str + "_" + poststr);
// sample.add_feature("W-2-1_" + prestr2 + "_" + prestr);
// sample.add_feature("W+1+2_" + poststr + "_" + poststr2);
// train = 10000 no effect
// if (i > 0 && prestr.size() >= 3)
// sample.add_feature("W-1S_" + prestr.substr(prestr.size()-3));
// if (i < (int)vt.size()-1 && poststr.size() >= 3)
// sample.add_feature("W+1S_" + poststr.substr(poststr.size()-3));
// sentence type
// sample.add_feature("ST_" + vt[vt.size()-1].str);
for (size_t j = 1; j <= 10; j++) {
char buf[1000];
// if (str.size() > j+1) {
if (str.size() >= j) {
sprintf(buf, "SUF%d_%s", (int)j, str.substr(str.size() - j).c_str());
sample.add_feature(buf);
}
// if (str.size() > j+1) {
if (str.size() >= j) {
sprintf(buf, "PRE%d_%s", (int)j, str.substr(0, j).c_str());
sample.add_feature(buf);
}
}
for (size_t j = 0; j < str.size(); j++) {
if (isdigit(str[j])) {
sample.add_feature("CTN_NUM");
break;
}
}
for (size_t j = 0; j < str.size(); j++) {
if (isupper(str[j])) {
sample.add_feature("CTN_UPP");
break;
}
}
for (size_t j = 0; j < str.size(); j++) {
if (str[j] == '-') {
sample.add_feature("CTN_HPN");
break;
}
}
bool allupper = true;
for (size_t j = 0; j < str.size(); j++) {
if (!isupper(str[j])) {
allupper = false;
break;
}
}
if (allupper) sample.add_feature("ALL_UPP");
if (WNdic.size() > 0) {
const string n = normalize(str);
for (map<string, string>::const_iterator i = WNdic.lower_bound(n); i != WNdic.upper_bound(n); i++) {
sample.add_feature("WN_" + i->second);
//.........这里部分代码省略.........