您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ stable_sort函数代码示例

51自学网 2021-06-03 08:20:49
  C++
这篇教程C++ stable_sort函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中stable_sort函数的典型用法代码示例。如果您正苦于以下问题:C++ stable_sort函数的具体用法?C++ stable_sort怎么用?C++ stable_sort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了stable_sort函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: row_items

void Viewport::paintEvent(QPaintEvent*){	vector< shared_ptr<RowItem> > row_items(view_.begin(), view_.end());	assert(none_of(row_items.begin(), row_items.end(),		[](const shared_ptr<RowItem> &r) { return !r; }));	stable_sort(row_items.begin(), row_items.end(),		[](const shared_ptr<RowItem> &a, const shared_ptr<RowItem> &b) {			return a->visual_v_offset() < b->visual_v_offset(); });	const vector< shared_ptr<TimeItem> > time_items(view_.time_items());	assert(none_of(time_items.begin(), time_items.end(),		[](const shared_ptr<TimeItem> &t) { return !t; }));	QPainter p(this);	p.setRenderHint(QPainter::Antialiasing);	const ViewItemPaintParams pp(rect(), view_.scale(), view_.offset());	for (const shared_ptr<TimeItem> t : time_items)		t->paint_back(p, pp);	for (const shared_ptr<RowItem> r : row_items)		r->paint_back(p, pp);	for (const shared_ptr<TimeItem> t : time_items)		t->paint_mid(p, pp);	for (const shared_ptr<RowItem> r : row_items)		r->paint_mid(p, pp);	p.setRenderHint(QPainter::Antialiasing, false);	for (const shared_ptr<RowItem> r : row_items)		r->paint_fore(p, pp);	for (const shared_ptr<TimeItem> t : time_items)		t->paint_fore(p, pp);	p.end();}
开发者ID:jhol,项目名称:pulseview,代码行数:38,


示例2: DP_CalculateMaxLoopLength

unsigned int DP_CalculateMaxLoopLength(        unsigned int nLoops, const unsigned int *loops,        double percentile, unsigned int extension, unsigned int cutoff){    vector < unsigned int > loopLengths(nLoops);    unsigned int index, max;    for (index=0; index<nLoops; ++index)        loopLengths[index] = loops[index];    stable_sort(loopLengths.begin(), loopLengths.end());    if (percentile < 1.0) {        index = (unsigned int)(percentile * (nLoops - 1) + 0.5);        max = loopLengths[index] + extension;    } else {  // percentile >= 1.0        max = ((unsigned int)(percentile * loopLengths[nLoops - 1] + 0.5)) + extension;    }    if (cutoff > 0 && max > cutoff)        max = cutoff;    return max;}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:23,


示例3: THROW_ERROR

/**/fn	void ActivatedItemMgr::Add(ActivatedItem *lpItem)/brief	Adds a new ActivatedItem to be managed. /author	dcofer/date	3/1/2011/param [in,out]	lpItem	The pointer to the item to add. **/void ActivatedItemMgr::Add(ActivatedItem *lpItem){	if(!lpItem)		THROW_ERROR(Al_Err_lActivatedItemNull, Al_Err_strActivatedItemNull);	//Lets make sure the ID of the item is in upper case.	lpItem->ID(Std_CheckString(lpItem->ID()));	//lets make sure this is a unique item key.	try	{		m_aryItemsMap.Add(lpItem->ID(), lpItem);	}	catch(CStdErrorInfo oError)	{		oError.m_strError += " Duplicate activate item Key: " + lpItem->ID(); 		THROW_ERROR(oError.m_lError, oError.m_strError);	}		m_aryItems.Add(lpItem);	stable_sort(m_aryItems.begin(), m_aryItems.end(), LessThanActivatedItemCompare);}
开发者ID:NeuroRoboticTech,项目名称:AnimatLabPublicSource,代码行数:33,


示例4: id_map_buf

void gcta::filter_snp_max_maf(double max_maf){    if(_mu.empty()) calcu_mu();    cout<<"Pruning SNPs with MAF < "<<max_maf<<" ..."<<endl;    map<string, int> id_map_buf(_snp_name_map);    map<string, int>::iterator iter, end=id_map_buf.end();    int prev_size=_include.size();    double fbuf=0.0;    _include.clear();    _snp_name_map.clear();    for(iter=id_map_buf.begin(); iter!=end; iter++){        fbuf=_mu[iter->second]*0.5;        if(fbuf>max_maf && 1.0-fbuf>max_maf) continue;        _snp_name_map.insert(*iter);        _include.push_back(iter->second);    }	if(_include.size()==0) throw("Error: No SNP is retained for analysis.");	else{		stable_sort(_include.begin(), _include.end());		cout<<"After pruning SNPs with MAF < "<<max_maf<<", there are "<<_include.size()<<" SNPs ("<<prev_size-_include.size()<<" SNPs with MAF > "<<max_maf<<")."<<endl;	}}
开发者ID:theboocock,项目名称:fine_mapping_pipeline,代码行数:23,


示例5: rect

void Header::paintEvent(QPaintEvent*){	const QRect rect(0, 0, width(), height());	vector< shared_ptr<ViewItem> > items(view_.list_by_type<ViewItem>());	stable_sort(items.begin(), items.end(),		[](const shared_ptr<ViewItem> &a, const shared_ptr<ViewItem> &b) {			return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); });	QPainter painter(this);	painter.setRenderHint(QPainter::Antialiasing);	for (const shared_ptr<ViewItem>& r : items) {		assert(r);		const bool highlight = !item_dragging_ &&			r->label_rect(rect).contains(mouse_point_);		r->paint_label(painter, rect, highlight);	}	painter.end();}
开发者ID:abraxa,项目名称:pulseview,代码行数:23,


示例6: reverse

int Fujimap::build_(vector<pair<string, uint64_t> >& kvs,		    FujimapBlock& fb){  reverse(kvs.begin(), kvs.end());  stable_sort(kvs.begin(), kvs.end(), kvsComp);  kvs.erase(unique(kvs.begin(), kvs.end(), kvsEq), kvs.end());  if (kvs.size() == 0){    return 0; // not build  }  for (int i = 0; i < 20; ++i){    vector<KeyEdge> keyEdges;    for (size_t i = 0; i < kvs.size(); ++i){      keyEdges.push_back(KeyEdge(kvs[i].first.c_str(), kvs[i].first.size(),				 kvs[i].second, seed_));    }    if (fb.build(keyEdges, seed_, fpLen_, et_) == 0){      break;    }    seed_ += 777;  }  return 0;}
开发者ID:pombredanne,项目名称:fujimap,代码行数:23,


示例7: file

voidBoard::saveTikZ( const char * filename, double pageWidth, double pageHeight, double margin ) const{  std::ofstream file( filename );  TransformTikZ transform;  Rect box = boundingBox();  bool clipping = _clippingPath.size() > 2;  if ( clipping )    box = box && _clippingPath.boundingBox();  transform.setBoundingBox( box, pageWidth, pageHeight, margin );  file << "//begin{tikzpicture}[anchor=south west,text depth=0,x={(1pt,0pt)},y={(0pt,-1pt)}]" << std::endl;  if ( clipping  ) {    file << "//clip ";    _clippingPath.flushTikZPoints( file, transform );    file << "/n";  }    // Draw the background color if needed.  if ( _backgroundColor != Color::None ) {     Rectangle r( box, Color::None, _backgroundColor, 0.0 );    r.flushTikZ( file, transform );  }  // Draw the shapes.  std::vector< Shape* > shapes = _shapes;  stable_sort( shapes.begin(), shapes.end(), shapeGreaterDepth );  std::vector< Shape* >::const_iterator i = shapes.begin();  std::vector< Shape* >::const_iterator end = shapes.end();  while ( i != end ) {    (*i)->flushTikZ( file, transform );    ++i;  }    file << "//end{tikzpicture}" << std::endl;  file.close();}
开发者ID:Lewerow,项目名称:DetailIdentifier,代码行数:37,


示例8: UINFO

void V3LinkLevel::modSortByLevel() {    // Sort modules by levels, root down to lowest children    // Calculate levels again in case we added modules    UINFO(2,"modSortByLevel()/n");    // level() was computed for us in V3LinkCells    typedef vector<AstNodeModule*> ModVec;    ModVec vec;    AstNodeModule* topp = NULL;    for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep; nodep=nodep->nextp()->castNodeModule()) {	if (nodep->level()<=2) {	    if (topp) {		nodep->v3warn(E_MULTITOP, "Unsupported: Multiple top level modules: "			      <<nodep->prettyName()<<" and "<<topp->prettyName());		nodep->v3warn(E_MULTITOP, "Fix, or use --top-module option to select which you want.");	    }	    topp = nodep;	}	vec.push_back(nodep);    }    stable_sort(vec.begin(), vec.end(), CmpLevel()); // Sort the vector    UINFO(9,"modSortByLevel() sorted/n");  // Comment required for gcc4.6.3 / bug666    for (ModVec::iterator it = vec.begin(); it != vec.end(); ++it) {	AstNodeModule* nodep = *it;	nodep->clearIter();  // Because we didn't iterate to find the node pointers, may have a stale m_iterp() needing cleanup	nodep->unlinkFrBack();    }    if (v3Global.rootp()->modulesp()) v3Global.rootp()->v3fatalSrc("Unlink didn't work");    for (ModVec::iterator it = vec.begin(); it != vec.end(); ++it) {	AstNodeModule* nodep = *it;	v3Global.rootp()->addModulep(nodep);    }    UINFO(9,"modSortByLevel() done/n");  // Comment required for gcc4.6.3 / bug666    V3Global::dumpCheckGlobalTree("cells.tree", false, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);}
开发者ID:mballance,项目名称:verilator-svtnt,代码行数:37,


示例9: items

void Header::on_group(){	const vector< shared_ptr<TraceTreeItem> > items(		view_.list_by_type<TraceTreeItem>());	vector< shared_ptr<TraceTreeItem> > selected_items(		make_filter_iterator(item_selected, items.begin(), items.end()),		make_filter_iterator(item_selected, items.end(), items.end()));	stable_sort(selected_items.begin(), selected_items.end(),		[](const shared_ptr<TraceTreeItem> &a, const shared_ptr<TraceTreeItem> &b) {			return a->visual_v_offset() < b->visual_v_offset(); });	shared_ptr<TraceGroup> group(new TraceGroup());	shared_ptr<TraceTreeItem> mouse_down_item(		std::dynamic_pointer_cast<TraceTreeItem>(mouse_down_item_));	shared_ptr<TraceTreeItem> focus_item(		mouse_down_item ? mouse_down_item : selected_items.front());	assert(focus_item);	assert(focus_item->owner());	focus_item->owner()->add_child_item(group);	// Set the group v_offset here before reparenting	group->force_to_v_offset(focus_item->layout_v_offset() +		focus_item->v_extents().first);	for (size_t i = 0; i < selected_items.size(); i++) {		const shared_ptr<TraceTreeItem> &r = selected_items[i];		assert(r->owner());		r->owner()->remove_child_item(r);		group->add_child_item(r);		// Put the items at 1-pixel offsets, so that restack will		// stack them in the right order		r->set_layout_v_offset(i);	}}
开发者ID:ntruchsess,项目名称:pulseview,代码行数:36,


示例10: aggregate_duplicates

int aggregate_duplicates( vector< struct adj >* adjstack ){	if( adjstack == NULL ){		printf("Error: adjstack pointer is null!/n");		printf("Source: aggregate_duplicates/n");		return 1;	}	stable_sort( adjstack->begin(), adjstack->end(), UDLess );	for( unsigned int i = 0; i < adjstack->size(); i++ ){		int location = locate( adjstack, adjstack->at(i).key1, adjstack->at(i).key2, i+1 );		while( location != -1 ){			// A duplicate exists			// Add the value at location to the adj at i			// Delete the entry at location			// Check for another duplicate			adjstack->at(i).value = adjstack->at(i).value + adjstack->at(location).value;			adjstack->erase( adjstack->begin() + location );			location = locate( adjstack, adjstack->at(i).key1, adjstack->at(i).key2, i+1 );		}	}	return 0;}
开发者ID:vladtastic,项目名称:community-detection-surprise,代码行数:36,


示例11: ConnNetInfo_Create

EIO_Status CConnTest::GetFWConnections(string* reason){    SConnNetInfo* net_info = ConnNetInfo_Create(0, m_DebugPrintout);    if (net_info) {        const char* user_header;        net_info->req_method = eReqMethod_Post;        if (net_info->firewall) {            user_header = "NCBI-RELAY: FALSE";            m_Firewall = true;        } else            user_header = "NCBI-RELAY: TRUE";        if (net_info->stateless)            m_Stateless = true;        ConnNetInfo_OverrideUserHeader(net_info, user_header);        ConnNetInfo_SetupStandardArgs(net_info, 0/*w/o service*/);    }    string temp(m_Firewall ? "FIREWALL" : "RELAY (legacy)");    temp += " connection mode has been detected for stateful services/n";    if (m_Firewall) {        temp += "This mode requires your firewall to be configured in such a"            " way that it allows outbound connections to the port range ["            STRINGIFY(CONN_FWD_PORT_MIN) ".." STRINGIFY(CONN_FWD_PORT_MAX)            "] (inclusive) at the two fixed NCBI addresses, "            NCBI_FWD_BEMD " and " NCBI_FWD_STVA "./n"            "To set that up correctly, please have your network administrator"            " read the following (if they have not already done so):"            " " NCBI_FWDOC_URL "/n";    } else {        temp += "This is an obsolescent mode that requires keeping a wide port"            " range [4444..4544] (inclusive) open to let through connections"            " to the entire NCBI site (130.14.xxx.xxx/165.112.xxx.xxx) -- this"            " mode was designed for unrestricted networks when firewall port"            " blocking had not been an issue/n";    }    if (m_Firewall) {        _ASSERT(net_info);        switch (net_info->firewall) {        case eFWMode_Adaptive:            temp += "Also, there are usually a few additional ports such as "                STRINGIFY(CONN_PORT_SSH) " and " STRINGIFY(CONN_PORT_HTTPS)                " at " NCBI_FWD_BEMD ", which can be used if connections to"                " the ports in the range described above, have failed/n";            break;        case eFWMode_Firewall:            temp += "Furthermore, your configuration explicitly forbids to use"                " any fallback firewall ports that may exist to improve"                " reliability of connection experience/n";            break;        case eFWMode_Fallback:            temp += "There are usually a few backup connection ports such as "                STRINGIFY(CONN_PORT_SSH) " and " STRINGIFY(CONN_PORT_HTTPS)                " at " NCBI_FWD_BEMD ", which can be used as a failover if"                " connections to the port range above fail.  However, your "                " configuration explicitly requests that only those fallback"                " firewall ports (if any exist) are to be used for"                " connections:  this also implies that no conventional ports"                " from the default range will be used/n";            break;        default:            temp += "Internal program error, please report!/n";            _ASSERT(0);            break;        }    } else {        temp += "This mode may not be reliable if your site has a restraining"            " firewall imposing a fine-grained control over which hosts and"            " ports the outbound connections are allowed to use/n";    }    if (m_HttpProxy) {        temp += "Connections to the aforementioned ports will be made via an"            " HTTP proxy at '";        temp += net_info->http_proxy_host;        temp += ':';        temp += NStr::UIntToString(net_info->http_proxy_port);        temp += "'";        if (net_info->http_proxy_leak) {	             temp += ".  If that is unsuccessful, a link bypassing the proxy"                " will then be attempted";        }    }    temp += '/n';    PreCheck(eFirewallConnPoints, 0/*main*/, temp);    PreCheck(eFirewallConnPoints, 1/*sub*/,             "Obtaining current NCBI " +             string(m_Firewall ? "firewall settings" : "service entries"));    EIO_Status status = x_GetFirewallConfiguration(net_info);    if (status == eIO_Interrupt)        temp = kCanceled;    else if (status == eIO_Success) {        if (!m_Fwd.empty()            ||  (!m_FwdFB.empty()                 &&  m_Firewall  &&  net_info->firewall == eFWMode_Fallback)) {            temp = "OK: ";            if (!m_Fwd.empty()) {                stable_sort(m_Fwd.begin(),   m_Fwd.end());//.........这里部分代码省略.........
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:101,


示例12: stable_sort

void ActorUtil::SortByZPosition( vector<Actor*> &vActors ){	// Preserve ordering of Actors with equal Z positions.	stable_sort( vActors.begin(), vActors.end(), CompareActorsByZPosition );}
开发者ID:AratnitY,项目名称:stepmania,代码行数:5,


示例13: valusorts

void valusorts(sfvector::iterator p1, sfvector::iterator p2) {  stable_sort(p1, p2, valult<float>);}
开发者ID:BIDData,项目名称:BIDMach,代码行数:3,


示例14: cin_chardef

//.........这里部分代码省略.........	    if (!validkey[kk])	    {		if (i || cmd1[i] != '#')		{		    oxim_perr(OXIMMSG_WARNING, N_("%s(%d): illegal key /"%c/" specified./n"), cintab->fname_cin, cintab->lineno, cmd1[i]);		}		allkey_valid = False;		break;	    }	}	if (!allkey_valid)	{	    continue;	}	th.n_icode ++;	if (th.n_icode == 1)	{	    cchar = oxim_malloc(sizeof(cin_char_t), True);	}	else	{	    cchar = oxim_realloc(cchar, (th.n_icode+1) * sizeof(cin_char_t));	}	cch = (cchar + th.n_icode) - 1; 	bzero(cch, sizeof(cin_char_t));	if ((cch->ucs4 = ccode_to_ucs4(arg1)) == 0)	{	    n_word ++;	    cch->word_len = strlen(arg1);	    cch->word = strdup(arg1);	    table_size += cch->word_len + sizeof(cch->word_len);	}	if (arg2[0] != '/0')	{	    cch->order = atoi(arg2);	}	oxim_keys2codes(cch->key, 2, cmd1);	cch->keystroke = strdup(cmd1);	th.n_ichar ++;	len = strlen(cmd1);	if (th.n_max_keystroke < len)	    th.n_max_keystroke = len;	arg2[0] = '/0';    }    /*     *  Determine the memory model.     */    ret = (th.n_max_keystroke <= 5) ? ICODE_MODE1 : ICODE_MODE2;    th.icode_mode = ret;    /*     *  Fill in the ichar, icode_idx and icode1, icode2 arrays.     */    stable_sort(cchar, th.n_icode, sizeof(cin_char_t), icode_cmp);    ichar = oxim_malloc(th.n_icode * sizeof(ichar_t), True);    icode1 = oxim_malloc(th.n_icode*sizeof(icode_t), True);    if (ret == ICODE_MODE2)    {        icode2 = oxim_malloc(th.n_icode*sizeof(icode_t), True);    }    if (n_word)    {	word_table = oxim_malloc(table_size, True);    }    unsigned int word_idx = 0;    unsigned int offset = 0;    unsigned int rec_len = 0;    for (i=0, cch=cchar; i<th.n_icode; i++, cch++)    {	ichar[i] = cch->ucs4;	/* ucs4 
C++ stack函数代码示例
C++ sta_info_get函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。