• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ order函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rubiks_cube

void rubiks_cube(QStringList list, QString color)
{
    QString rubiks_cube = "empty,yellow,empty,"+color+",empty,empty";
    QStringList yellow_wall;

    foreach (const QString &str, list)
    {
        if (str.contains("yellow") && str.count('\n') == 2)
        {
            yellow_wall += str;
        }
    }

    yellow_wall = order(yellow_wall, "yellow");

    QString help;
    help = yellow_wall.at(0);
    rubiks_cube.replace(rubiks_cube.indexOf("empty"), QString::fromStdString("empty").count(), help.section('\n', 1, 1));
    rubiks_cube.replace(rubiks_cube.indexOf("empty"), QString::fromStdString("empty").count(), help.section('\n', 2, 2));

    for(int i = 1; i < yellow_wall.count(); i++)
    {
        if(!yellow_wall.at(i).contains(help.section('\n', 1, 1)) && !yellow_wall.at(i).contains(help.section('\n', 2, 2)))
        {
            help = yellow_wall.at(i);
            rubiks_cube.replace(rubiks_cube.indexOf("empty"), QString::fromStdString("empty").count(),help.section('\n', 2, 2));
            rubiks_cube.replace(rubiks_cube.indexOf("empty"), QString::fromStdString("empty").count(),help.section('\n', 1, 1));
        }
    }

    QStringList color_short;
    for(int i = 0; i <= rubiks_cube.count(','); i++)
    {
        help = rubiks_cube.section(',', i, i);
        help.remove(1, help.count()-1);
        help = help.toUpper();
        color_short << help;
    }

    print_rubiks_cube(color_short);
}
开发者ID:mramotowski,项目名称:Repo,代码行数:41,代码来源:functions.cpp


示例2: order

void Foam::hierarchGeomDecomp::setDecompOrder()
{
    word order(geomDecomDict_.lookup("order"));

    if (order.size() != 3)
    {
        FatalIOErrorIn
        (
            "hierarchGeomDecomp::hierarchGeomDecomp"
            "(const dictionary& decompositionDict)",
            decompositionDict_
        )   << "number of characters in order (" << order << ") != 3"
            << exit(FatalIOError);
    }

    for (label i = 0; i < 3; i++)
    {
        if (order[i] == 'x')
        {
            decompOrder_[i] = 0;
        }
        else if (order[i] == 'y')
        {
            decompOrder_[i] = 1;
        }
        else if (order[i] == 'z')
        {
            decompOrder_[i] = 2;
        }
        else
        {
            FatalIOErrorIn
            (
                "hierarchGeomDecomp::hierarchGeomDecomp"
                "(const dictionary& decompositionDict)",
                decompositionDict_
            )   << "Illegal decomposition order " << order << endl
                << "It should only contain x, y or z" << exit(FatalError);
        }
    }
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:41,代码来源:hierarchGeomDecomp.C


示例3: solve

    void solve(string s, size_t pos, size_t depth, set<string> &res) {
        bool neg;
        
        auto o = order(s, neg);
        if (o == 0) {
            if(neg == false)
                res.insert(s);
            return;
        }
        if (depth == 0)
            return;

        //cout << "s=" << s << " pos=" << pos << " depth=" << depth << endl;
        for (int i = pos; i < s.size(); i++) {
            if (s[i] == '(') {
                string tmp = s;
                tmp.erase(i, 1);
                solve(tmp, i, depth-1, res);
            }
        }
    }
开发者ID:hkoehler,项目名称:LeetCode,代码行数:21,代码来源:removeInvalidParantheses.cpp


示例4: order

//===========================================================================
void SplineCurve::makeKnotStartRegular()
//===========================================================================
{
    // Testing whether knotstart is already d+1-regular.
    if (basis_.begin()[0] < basis_.begin()[order() - 1]) {
	
	double tpar = basis_.startparam();
	int ti = order() - 1; // Index of last occurence of tpar (in other_curve).
	int mt = 1; // Multiplicity of tpar.
	
	while ((basis_.begin()[ti - mt] == tpar) && (mt < order())) ++mt;
	std::vector<double> new_knots;
	for (int i = 0; i < order() - mt; ++i) new_knots.push_back(tpar);
	insertKnot(new_knots);
	coefs_.erase(coefs_begin(), coefs_begin() + (order() - mt) * dim_);
	basis_ = BsplineBasis(order(), basis_.begin() + order() - mt,
				basis_.end());
    }
}
开发者ID:99731,项目名称:GoTools,代码行数:20,代码来源:GSCappendCurve.C


示例5: query

QList<Model::CanceledOrder> CanceledOrder::getAll()
{
    QList<Model::CanceledOrder> canceledOrders;

    DatabaseManager mgr;
    QSqlQuery query("SELECT * from order_canceled");
    query.exec();

    while(query.next()) {
        int id = query.value(0).toInt();
        int order_id = query.value(1).toInt();
        QDateTime cancel_time = query.value(2).toDateTime();

        Model::Order order(order_id);
        Model::CanceledOrder canceledOrder(id, order, cancel_time);

        canceledOrders.append(canceledOrder);
    }

    return canceledOrders;
}
开发者ID:AmiZya,项目名称:mangotalaat,代码行数:21,代码来源:canceledorder.cpp


示例6: listEccentricities

 std::vector<long> listEccentricities(const Graph & g)
 {
     dMatrix dist = distanceMatrix(g);
     long n = order(g);
     std::vector<long> res(n);
     for (long i = 0; i < n; i++)
     {
         long m = 0;
         for (long j = 0; j < n; j++)
         {
             if (m < dist[i][j])
             {
                 m = dist[i][j];
             }
         }
         res[i] = m;
     }
     make_heap(res.begin(), res.end());
     sort_heap(res.begin(), res.end());
     return res;
 }
开发者ID:antegallya,项目名称:phoeg,代码行数:21,代码来源:invariants.hpp


示例7: sort

void
sort(		/* sort primitives according to pcmp */
FILE  *infp,
int  (*pcmp)()		/* compares pointers to pointers to primitives! */
)
{
 PRIMITIVE  *prims[PBSIZE];		/* pointers to primitives */
 PLIST  primlist;			/* our primitives list */
 int  nprims;
 short  done;

 do  {

    for (nprims = 0; nprims < PBSIZE; nprims++)  {	/* read to global */

       if ((prims[nprims] = palloc()) == NULL)
          error(SYSTEM, "memory exhausted in sort");

       readp(prims[nprims], infp);

       if (isglob(prims[nprims]->com))
	  break;
       }

	qsort(prims, nprims, sizeof(*prims), pcmp);	/* sort pointer array */

	if (nprims < PBSIZE)			/* tack on global if one */
	    nprims++;

	order(prims, nprims, &primlist);	/* make array into list */

	sendsort(&primlist, pcmp);		/* send to merge sorter */

	done = primlist.pbot->com == PEOF;

	plfree(&primlist);			/* free up array */

    }  while (!done);

 }
开发者ID:Pizookies,项目名称:Radiance,代码行数:40,代码来源:sort.c


示例8: timeInForce

void Application::onMessage( const FIX42::NewOrderSingle& message, const FIX::SessionID& )
{
  FIX::SenderCompID senderCompID;
  FIX::TargetCompID targetCompID;
  FIX::ClOrdID clOrdID;
  FIX::Symbol symbol;
  FIX::Side side;
  FIX::OrdType ordType;
  FIX::Price price;
  FIX::OrderQty orderQty;
  FIX::TimeInForce timeInForce( FIX::TimeInForce_DAY );

  message.getHeader().get( senderCompID );
  message.getHeader().get( targetCompID );
  message.get( clOrdID );
  message.get( symbol );
  message.get( side );
  message.get( ordType );
  if ( ordType == FIX::OrdType_LIMIT )
    message.get( price );
  message.get( orderQty );
  if ( message.isSetField( timeInForce ) )
    message.get( timeInForce );

  try
  {
    if ( timeInForce != FIX::TimeInForce_DAY )
      throw std::logic_error( "Unsupported TIF, use Day" );

    Order order( clOrdID, symbol, senderCompID, targetCompID,
                 convert( side ), convert( ordType ),
                 price, (long)orderQty );

    processOrder( order );
  }
  catch ( std::exception & e )
  {
    rejectOrder( senderCompID, targetCompID, clOrdID, symbol, side, e.what() );
  }
}
开发者ID:WeizhongDai,项目名称:fixfeed,代码行数:40,代码来源:Application.cpp


示例9: run

int run(){

const int order_ = 20;
int numshape = (order_+1)*(order_+1)*(order_+1);

  TPZVec<REAL> point(3,0.);
  TPZVec<int> id(8);
  int i;

  for(i = 0; i< 8; i ++)
  {
  	id[i] = i;
  }

  TPZVec<int> order(19);
  for(i = 0; i< 19; i ++)
  {
        order[i] = order_;
  }

  TPZCompEl::SetgOrder(order_);

  TPZVec<FADREAL> phi(numshape);
  TPZFMatrix OldPhi(numshape,1), OldDPhi(3,numshape);
  TPZFMatrix DiffPhi(numshape,1), DiffDPhi(3,numshape);

  TPZShapeCube::ShapeCube(point, id, order, phi);
  TPZShapeCube::ShapeCube(point, id, order, OldPhi, OldDPhi);

  /*cout << "Calculated by Fad" << phi;
  cout << "Old derivative method (phi)\n" << OldPhi;
  cout << "Old derivative method (dPhi)\n" << OldDPhi;

  shapeFAD::ExplodeDerivatives(phi, DiffPhi, DiffDPhi);
  DiffPhi-=OldPhi;
  DiffDPhi-=OldDPhi;*/
  //cout << "FAD derivative method (phi)\n" << /*TPZFMatrix (OldPhi -*/ DiffPhi;
  //cout << "FAD derivative method (dPhi)\n" <</* TPZFMatrix (OldDPhi -*/ DiffDPhi;
  return 0;
}
开发者ID:labmec,项目名称:neopz,代码行数:40,代码来源:main.cpp


示例10: main

void main()
{
    int choice = 0;
    menu();
    scanf("%d", &choice);
    while(choice)
    {
        switch(choice)
        {
            case 1:
                init();
                break;
            case 2:
                search();
                break;
            case 3:
                del();
                break;
            case 4:
                modify();
                break;
            case 5:
                insert();
                break;
            case 6:
                order();
                break;
            case 7:
                total();
                break;
            default: break;
        }
        getchar();
        menu();
        scanf("%d", &choice);
    }
    getchar();
    return;
}
开发者ID:Clover1990,项目名称:learning,代码行数:39,代码来源:main.c


示例11: radius

 long radius(const Graph & g)
 {
     dMatrix mat = distanceMatrix(g);
     long n = order(g);
     long rad = INF;
     for (long i = 0; i < n; ++i)
     {
         long max = -1;
         for (long j = 0; j < n; ++j)
         {
             if (mat[i][j] > max)
             {
                 max = mat[i][j];
             }
         }
         if (max < rad)
         {
             rad = max;
         }
     }
     return rad;
 }
开发者ID:antegallya,项目名称:phoeg,代码行数:22,代码来源:invariants.hpp


示例12: main

int main()
{
    int i;
    int src[10];

    printf("input 10 number : ");
    for(i = 0; i < 10; i++)
    {
        scanf("%d",&src[i]);
    }

    order(src);

    printf("output ordering munber is :");
    for(i = 0; i < 10; i++)
    {
        printf("%d ",src[i]);

    }
    printf("\n");
    return 0;
}
开发者ID:Jerey-Jobs,项目名称:Studentwork,代码行数:22,代码来源:order.c


示例13: main

int main()
{
    std::priority_queue<order, std::vector<order>, order> q;
    std::vector<order> v;
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        v.push_back(order(x, y, i));
    }
    std::sort(v.begin(), v.end(), 
              [] (const order& a, const order& b) { return a.deadline < b.deadline; });
    for(auto it = v.begin(); it < v.end(); it++)
    {
        if(it->deadline == q.size() && q.top().reward < it->reward)
        {    // The size of q is equal to the day number, if it surpasses the deadline of the
             // current order, we can't meet it, so we (possibly) replace some earlier order
             q.pop();
             q.push(*it);
        }
        else if(it->deadline > q.size())
            q.push(*it);
    }
    printf("%d\n", q.size());
    std::vector<order> ans;

    while(!q.empty())
    {
        ans.push_back(q.top());
        q.pop();
    }
    std::sort(ans.begin(), ans.end(), 
              [] (const order& o1, const order& o2) { return o1.deadline < o2.deadline; } );
    for(auto it = ans.begin(); it < ans.end(); it++)
        printf("%d ", it->number);
    return 0;
}
开发者ID:draak-krijger,项目名称:timus,代码行数:39,代码来源:1403.cpp


示例14: order

lsdouble SchedulingNativeFunction::call(const LSNativeContext& context) {
	vector<int> order(p.numJobs);
	if (context.count() < varCount()) return numeric_limits<double>::lowest();

	for (int i = 0; i < p.numJobs; i++) {
		order[i] = static_cast<int>(context.getIntValue(i));
		if (order[i] == Project::UNSCHEDULED)
			return numeric_limits<double>::lowest();
	}
	SGSResult result = decode(order, context);
	lsdouble profit = static_cast<lsdouble>(p.calcProfit(result));

	if (tr != nullptr) {
		if(profit > bks)
			bks = profit;
		tr->intervalTrace(static_cast<float>(bks));
	}

	// TODO: result.numSchedulesGenerated

	return profit;
}
开发者ID:0x17,项目名称:CPP-RCPSP-OC,代码行数:22,代码来源:ListModel.cpp


示例15: eccentricConnectivity

 long eccentricConnectivity(const Graph & g)
 {
     long res = 0, n = order(g);
     dMatrix dist = distanceMatrix(g);
     for (long i = 0; i < n; i++)
     {
         long ecc = 0, deg = 0;
         for (long j = 0; j < n; j++)
         {
             if (edge(i,j,g).second)
             {
                 deg++;
             }
             if (dist[i][j] > ecc)
             {
                 ecc = dist[i][j];
             }
         }
         res += ecc * deg;
     }
     return res;
 }
开发者ID:antegallya,项目名称:phoeg,代码行数:22,代码来源:invariants.hpp


示例16: main

int main() {
    auto src = std::vector<int> { 6, 4, 4, 2, 2, 3, 3, 3, 3 };
    auto const N = src.size();
    
    auto ord = std::vector<int> {};
    ord.reserve(N);
    iota_n(std::back_inserter(ord), N, 0);
    
    auto rnk = std::vector<double> {};
    rnk.reserve(N);
    iota_n(std::back_inserter(rnk), N, 0.0);
  
    std::cout << "unsorted data \n\n";
    std::cout << "i --> s o r \n";
    std::cout << "=========== \n";
    for (std::size_t i = 0; i < N; ++i) 
        std::cout << i << " --> " << src[i] << " " << ord[i] << " " << rnk[i] << "\n";
  
    order(begin(src), end(src), begin(ord));
    rank(begin(src), end(src), begin(ord), begin(rnk));

    std::cout << "sorted data \n\n";
    std::cout << "i --> s o r \n";
    std::cout << "=========== \n";
    for (std::size_t i = 0; i < N; ++i) 
        std::cout << i << " --> " << src[i] << " " << ord[i] << " " << rnk[i] << "\n";


/*
    // show sorted indices and tie-adjusted ranks                                              //
    cout << "i --> v I R \n============= \n";
    for (size_t i=0; i<orig.size(); i++) 
      cout << i << " --> " << orig[i] << " " << idxs[i] << " " << rnks[i] << endl;
    cout << "i --> v I R\n";
*/
                                                                                //

}
开发者ID:CCJY,项目名称:coliru,代码行数:38,代码来源:main.cpp


示例17: getHUD

order PossessorPlayer::getOrder() {
	if (getHUD() != nullptr && getHUD()->getUIState() != nullptr
			&& getHUD()->getUIState()->ui_active) {
		//do nothing
		return order();
	}
	assert(player);
	order o;
	auto method = player->getInputMethod();
	vector2F v = method->getMovementVector();
	if (v.getMagnitude() > 1)
		v.setMagnitude(1);
	o.movement = v;
	o.movement_magnitude_procuntual = true;
	if (method->getAction(InputMethod::AIM)) {
		o.movement=aim_dir;
		o.aim=aim_dir;
		o.stand_in_place=true;
	} else if (!o.movement.isZero()&&!o.stand_in_place) {
		aim_dir={0,0};
		aiming=false;
	}
	if (method->getAction(InputMethod::ATTACK_0)) {
		o.attack_type=0;
		o.do_attack=true;
	}
	if (method->getAction(InputMethod::ATTACK_1)) {
		o.attack_type=1;
		o.do_attack=true;
	}
	if (method->getAction(InputMethod::ATTACK_2)) {
		o.attack_type = 2;
		o.do_attack = true;
	}
	o.do_context_sensitive = method->getAction(InputMethod::CONTEXT_SENSITIVE);
	o.dash = method->getAction(InputMethod::DASH);
	return o;
}
开发者ID:nstbayless,项目名称:sdlgame,代码行数:38,代码来源:PossessorPlayer.cpp


示例18: StickerSet

void StickerSetInner::installDone(const MTPBool &result) {
	StickerSets &sets(cRefStickerSets());

	sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)).value().stickers = _pack;

	int32 insertAtIndex = 0;
	StickerSetsOrder &order(cRefStickerSetsOrder());
	for (int32 s = order.size(); insertAtIndex < s; ++insertAtIndex) {
		StickerSets::const_iterator i = sets.constFind(order.at(insertAtIndex));
		if (i == sets.cend() || !(i->flags & MTPDstickerSet_flag_official)) {
			break;
		}
	}
	int32 currentIndex = cStickerSetsOrder().indexOf(_setId);
	if (currentIndex != insertAtIndex) {
		if (currentIndex > 0) {
			order.removeAt(currentIndex);
			if (currentIndex < insertAtIndex) {
				--insertAtIndex;
			}
		}
		order.insert(insertAtIndex, _setId);
	}

	StickerSets::iterator custom = sets.find(CustomStickerSetId);
	if (custom != sets.cend()) {
		for (int32 i = 0, l = _pack.size(); i < l; ++i) {
			custom->stickers.removeOne(_pack.at(i));
		}
		if (custom->stickers.isEmpty()) {
			sets.erase(custom);
		}
	}
	cSetStickersHash(QByteArray());
	Local::writeStickers();
	emit installed(_setId);
	App::wnd()->hideLayer();
}
开发者ID:noscripter,项目名称:tdesktop,代码行数:38,代码来源:stickersetbox.cpp


示例19: get_count

void metadb_handle_list::remove_duplicates(bool b_release)
{
	unsigned count = get_count();
	if (count>0)
	{
		bit_array_bittable mask(count);
		mem_block_t<int> order(count);

		sort_by_format_get_order(order,"%_path_raw%|$num(%_subsong%,9)",0);

		unsigned n;
		for(n=0;n<count-1;n++)
		{
			if (get_item(order[n])==get_item(order[n+1]))
			{
				mask.set(order[n+1],true);
			}
		}

		if (b_release) delete_mask(mask);
		else remove_mask(mask);
	}
}
开发者ID:Annovae,项目名称:desmume,代码行数:23,代码来源:metadb_handle.cpp


示例20: name

/**
If an entry referring to a database with name aFullName does not exist in the container, a new entry will be created,
a connection with the database established.
If an entry with the specified name already exists, no new entry wil be created, the reference counter of the existing one 
will be incremented.

@param aFullName The full database name, including the path.
@param aSettings Per-database background compaction settings

@leave KErrNoMemory, an out of memory condition has occurred;
                     Note that the function may also leave with some other database specific 
                     errors categorised as ESqlDbError, and other system-wide error codes.

@panic SqlDb 4 In _DEBUG mode. Too short or too long database name (aFullName parameter)
@panic SqlDb 7 In _DEBUG mode. An entry with the specified name has been found but the entry is NULL.
*/
void CSqlCompactor::AddEntryL(const TDesC& aFullName, const TSqlCompactSettings& aSettings)
	{
	__ASSERT_DEBUG(aFullName.Length() > 0 && aFullName.Length() <= KMaxFileName, __SQLPANIC(ESqlPanicBadArgument));
	SQLCOMPACTOR_INVARIANT();
	CSqlCompactEntry* entry = NULL;
	TInt idx = iEntries.FindInOrder(aFullName, &CSqlCompactor::Search);
	if(idx == KErrNotFound)
		{
		SQL_TRACE_COMPACT(OstTraceExt4(TRACE_INTERNALS, CSQLCOMPACTOR_ADDENTRYL1, "0x%X;CSqlCompactor::AddEntryL;New entry;aFullName=%S;iStepLength=%d;iFreePageThreashold=%d", (TUint)this, __SQLPRNSTR(aFullName), aSettings.iStepLength, aSettings.iFreePageThresholdKb));
		entry = CSqlCompactEntry::NewLC(aFullName, iConnFactoryL, aSettings, *iTimer);
		TLinearOrder<CSqlCompactEntry> order(&CSqlCompactor::Compare);
		__SQLLEAVE_IF_ERROR(iEntries.InsertInOrder(entry, order));
		CleanupStack::Pop(entry);
		}
	else
		{
		SQL_TRACE_COMPACT(OstTraceExt4(TRACE_INTERNALS, CSQLCOMPACTOR_ADDENTRYL2, "0x%X;CSqlCompactor::AddEntryL;Reuse entry;aFullName=%S;iStepLength=%d;iFreePageThreashold=%d", (TUint)this, __SQLPRNSTR(aFullName), aSettings.iStepLength, aSettings.iFreePageThresholdKb));
		entry = iEntries[idx];
		__ASSERT_DEBUG(entry != NULL, __SQLPANIC(ESqlPanicInternalError));
		(void)entry->AddRef();
		}
	SQLCOMPACTOR_INVARIANT();
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:39,代码来源:SqlCompact.cpp



注:本文中的order函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ png_get_image_height函数代码示例发布时间:2022-05-31
下一篇:
C++ orb_unsubscribe函数代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap