本文整理汇总了C++中map::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ map::push_back方法的具体用法?C++ map::push_back怎么用?C++ map::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map
的用法示例。
在下文中一共展示了map::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vector< string > get_first(vector< string > cur){
vector< string > first;
for (int i=0; i<cur.size(); i++){
if (Vt.find(cur[i]) != Vt.end()){ // 如果当前为终结符,直接返回
first.push_back(cur[i]);
return first;
}
bool flag = true;
for (int j=0; j<syntax.size(); j++){
if (syntax[j].left == cur[i]){
vector< string > tmp;
tmp = get_first(syntax[j].right);
for (int k=0; k<tmp.size(); k++){
first.push_back(tmp[k]);
}
if (find(tmp.begin(), tmp.end(), "$") == tmp.end()){
flag = false;
}else{
flag = true;
}
}
}
if (!flag) break;
}
return first;
}
示例2: aggregator_admin_overview
string aggregator_admin_overview()
{
map <string, map <string, string> > form;
vector < map <string, string> > feeds;
map <string, string> feed;
set_page_title( "Feed aggregator" );
form["feeds"]["#type"] = "table";
form["feeds"]["#header"] = "Title,Items,Last update,Next update,Operations, , ";
form["feeds"]["#weight"] = "1";
form["feeds"]["#prefix"] = "<h3>Feed overview</h3>";
if(DB_TYPE==1)
{
REDIS_RES *result = redis_query_fields("SORT aggregator_feed BY aggregator_feed:*->title ALPHA", "GET aggregator_feed:*->", "#fid,title,url,refresh,checked,link,description,etag,modified,image,block");
while( redis_fetch_fields( result, feed ) ) {
feed["items"] = redis_str("SCARD aggregator_item:fid:%d", intval(feed["fid"]) );
feeds.push_back( feed );
}
}
if(DB_TYPE==2)
{
MYSQL_RES * result = db_querya("SELECT f.*, COUNT(i.iid) AS items FROM aggregator_feed f LEFT JOIN aggregator_item i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.etag, f.modified, f.image, f.block ORDER BY f.title");
while ( db_fetch( result, feed ) ) {
feeds.push_back( feed );
}
}
for(size_t n=0; n< feeds.size(); n++)
{
form["tit_"+str(n)]["#type"] = "markup";
form["tit_"+str(n)]["#value"] = "<a href=\""+url("aggregator/sources/"+feeds[n]["fid"])+"\">"+feeds[n]["title"]+"</a>";
form["tit_"+str(n)]["#table"] = "feeds";
form["ite_"+str(n)]["#type"] = "markup";
form["ite_"+str(n)]["#value"] = format_plural( intval(feeds[n]["items"]), "%i item", "%i items" );
form["ite_"+str(n)]["#table"] = "feeds";
form["ago_"+str(n)]["#type"] = "markup";
form["ago_"+str(n)]["#value"] = intval( feeds[n]["checked"] ) ? format_interval(time() - intval(feeds[n]["checked"]) )+" ago" : "never";
form["ago_"+str(n)]["#table"] = "feeds";
form["lef_"+str(n)]["#type"] = "markup";
form["lef_"+str(n)]["#value"] = intval( feeds[n]["checked"] ) ? format_interval( intval(feeds[n]["checked"]) + intval(feeds[n]["refresh"]) - time()) + " left" : "never";
form["lef_"+str(n)]["#table"] = "feeds";
form["edi_"+str(n)]["#type"] = "markup";
form["edi_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/edit/feed/"+feeds[n]["fid"])+"\">edit</a>";
form["edi_"+str(n)]["#table"] = "feeds";
form["rem_"+str(n)]["#type"] = "markup";
form["rem_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/remove/feed/"+feeds[n]["fid"])+"\">remove items</a>";
form["rem_"+str(n)]["#table"] = "feeds";
form["upd_"+str(n)]["#type"] = "markup";
form["upd_"+str(n)]["#value"] = "<a href=\""+url("admin/aggregator/update/feed/"+feeds[n]["fid"])+"\">update items</a>";
form["upd_"+str(n)]["#table"] = "feeds";
form["feeds"]["#row"+str(n)] = "tit_"+str(n)+",ite_"+str(n)+",ago_"+str(n)+",lef_"+str(n)+",edi_"+str(n)+",rem_"+str(n)+",upd_"+str(n);
}
return get_form("aggregator_admin_overview", form);
}