当前位置: 首页>>代码示例>>C++>>正文


C++ queue::size方法代码示例

本文整理汇总了C++中queue::size方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::size方法的具体用法?C++ queue::size怎么用?C++ queue::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在queue的用法示例。


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

示例1: push_ourlqueue

static void push_ourlqueue(Url * ourl)
{
    pthread_mutex_lock(&oq_lock);
    ourl_queue.push(ourl);
    if (ourl_queue.size() == 1)
        pthread_cond_broadcast(&oq_cond);
    pthread_mutex_unlock(&oq_lock);
}
开发者ID:DennyDL,项目名称:spiderPro,代码行数:8,代码来源:url.cpp

示例2: showMeAdapterSizes

void showMeAdapterSizes(queue <Slav *> queue, stack <Slav *> stack)
{
	printf("[queue_size = %lu, stack_size = %lu, existingSlavs = %i]\n",
		queue.size(),
		stack.size(),
		Slav::counter());

}
开发者ID:MatNim,项目名称:lab3,代码行数:8,代码来源:Slav.cpp

示例3: push

 // Push element x onto stack.
 void push(int x) {
     _.push(x);
     for (int i = 0; i < _.size() - 1; i++)
     {
         _.push(_.front());
         _.pop();
     }
 }
开发者ID:polossk,项目名称:LeetCode-OJ-Solution,代码行数:9,代码来源:leetcode225.cpp

示例4: handDestroy

void XN_CALLBACK_TYPE handDestroy(HandsGenerator &generator, XnUserID user, XnFloat fTime, void *pCookie){
	printf("hand destroy \n");
	if (hand1ID == user) {
		hand1ID = -1;
		while (hand1.size() > 0) {
			hand1.pop();
		}
	} else if (hand2ID == user) {
		hand2ID = -1;
		while (hand2.size() > 0) {
			hand2.pop();
		}
	}
	oldZoom = 1;
	oldAngle = 0;
	g_GestureGenerator.AddGesture(GESTURE_TO_USE, NULL);
}
开发者ID:abdullah38rcc,项目名称:KinectGestureRecognition,代码行数:17,代码来源:OpenCVKinect2D.cpp

示例5: pop

void Stack::pop(){
    while(q1.size() != 1){
        q2.push(q1.front());
        q1.pop();
    }
    q1.pop();
    swap(q1, q2);
}
开发者ID:y1y,项目名称:DS-Algo,代码行数:8,代码来源:stackAqueue.cpp

示例6: handUpdate

void XN_CALLBACK_TYPE handUpdate(HandsGenerator &generator, XnUserID user, const XnPoint3D *pPosition, XnFloat fTime, void *pCookie){

	if (hand1ID == user) {
		if (hand1.size() > 2) {
			hand1.pop();
		}
		hand1.push(*pPosition);
	} else if (hand2ID == user) {
		
		if (hand2.size() > 2) {
			hand2.pop();
		}
		hand2.push(*pPosition);
	}

	//printf("handUpdate: x %f y %f z %f \n", pPosition->X, pPosition->Y, pPosition->Z);
}
开发者ID:abdullah38rcc,项目名称:KinectGestureRecognition,代码行数:17,代码来源:OpenCVKinect2D.cpp

示例7: pop

    // Removes the element on top of the stack.
    void pop() {
        int len = my_que_A.size();
	    for(int i=0; i<len-1; i++) {
			my_que_A.push(my_que_A.front());
			my_que_A.pop();
	    }
		my_que_A.pop();
    }
开发者ID:YuxuanHe,项目名称:Leetcode,代码行数:9,代码来源:Implement+Stack+using+Queues.cpp

示例8: main

int main(int argc, const char * argv[]) {
    // insert code here...
    url_t output_url;
    output_url = parse_single_URL(argv[1]);
    depth=atoi(argv[2]);
    urlStruct init;
    init.url=output_url;
    urlQueue.push(init);
    
    
    
    for (int i=0; i<10; i++) {
        while(!urlQueue.empty()){
            
            
            
            urlStruct nextUrl=urlQueue.front();
            urlQueue.pop();
            
            
            dataStruct temp1 = retrieveWebPage(nextUrl.url, nextUrl.depth);
            if (temp1.data) {
                dataQueue.push(temp1);
                
            }
        }
        
        if (!dataQueue.empty()) {
            std::cout<<"\n DATAQUEUE SIZE:"<<dataQueue.size()<<"\n";
            dataStruct data=dataQueue.front();
            dataQueue.pop();
            
            parseWebPage(data);
            std::cout<<"\n"<<urlQueue.size()<<"\n";
            
            numberInQueue--;
            
        }
    
        
    }
    
    
    return 0;
}
开发者ID:cszongyang,项目名称:WebCrawler,代码行数:45,代码来源:main.cpp

示例9: push

 // Push element x onto stack.
 void push(int x) {
   size_t size = q.size();
   q.push(x);
   for( ; size > 0; --size ) {
     int tmp = q.front();
     q.pop();
     q.push(tmp);
   }
 }
开发者ID:justinj656,项目名称:oj-leetcode,代码行数:10,代码来源:implement_stack_using_queues.cpp

示例10: pop

 // Removes the element on top of the stack.
 void pop() {
     queue<int> tmp;
     int length = stack.size() - 1;
     for (int i = 0; i < length; i++) {
         tmp.push(stack.front());
         stack.pop();
     }
     stack = tmp;
 }
开发者ID:andy-sheng,项目名称:leetcode,代码行数:10,代码来源:225-Implement-Stack-using-Queues.cpp

示例11: poo

	string poo()
	{
		if (foodBuffer.size() == 0)
			throw petHungryException;

		string ans = foodBuffer.front();
		foodBuffer.pop();
		return ans;
	}
开发者ID:PawelLegowski,项目名称:ExampleSample,代码行数:9,代码来源:ExampleSample.cpp

示例12: main

int main(){
	ios_base::sync_with_stdio(false);
	cin >> h >> t >> r;
	cin >> n;
	for(int i = 1; i <= n; i++){
		int fi, se;
		cin >> fi >> se;
		a[i] = MP(fi, se);
	}
	cin >> m;
	for(int i = 1; i <= m; i++){
		int fi, se;
		cin >> fi >> se;
		b[i] = MP(fi, se);
	}
	Q.push(MP(h, t));
	mark[h][t] = true;
	while(Q.size()){
		pie v = Q.front();
		Q.pop();
		if(v == MP(0, 0)){
			cout << "Ivan" << endl;
			cout << he[0][0] << endl;
			return 0;
		}
		for(int i = 1; i <= min(v.L, n); i++){
			pie u = v;
			u.L -= i;
			u.L += a[i].L;
			u.R += a[i].R;
			if(mark[u.L][u.R])
				continue;
			if(u.L + u.R <= r){
				he[u.L][u.R] = he[v.L][v.R] + 1;
				mark[u.L][u.R] = true;
				Q.push(u);
			}
		}
		for(int i = 1; i <= min(v.R, m); i++){
			pie u = v;
			u.R -= i;
			u.R += b[i].R;
			u.L += b[i].L;
			if(mark[u.L][u.R])
				continue;
			if(u.L + u.R <= r){
				he[u.L][u.R] = he[v.L][v.R] + 1;
				mark[u.L][u.R] = true;
				Q.push(u);
			}
		}
	}
	dfs(MP(h, t));
	cout << "Zmey" << endl
		<< DP(MP(h, t)) << endl;
	return 0;
}
开发者ID:MaGar0-o,项目名称:Public,代码行数:57,代码来源:E.cpp

示例13: pop

 // Removes the element on top of the stack.
 void pop() {
     queue<int> tmp;
     while(q.size() > 1){
         int x = q.front();
         q.pop();
         tmp.push(x);
     }
     q = tmp;
 }
开发者ID:BoeingX,项目名称:leetcode,代码行数:10,代码来源:implement-stack-using-queues.cpp

示例14: pop

void pop(){
    for(int i = 0; i<q.size()-1;i++)
    {
        int top = q.front();
        q.pop();
        q.push(top);
    }
    q.pop();
}
开发者ID:dalanlan,项目名称:algo,代码行数:9,代码来源:ImplementStackUsingQueue.cpp

示例15: dequeue

void dequeue()
{
    if(q1.size()==0)
    {
        cout<<"underflow"<<endl;
        return;
    }
    while(q1.size()!=1)
    {
        q2.push(q1.front());
        q1.pop();
    }
    cout<<"popped element"<<q1.back()<<endl;
    q1.pop();
    temp=q2;
    q2=q1;
    q1=temp;
}
开发者ID:shreynagpal017,项目名称:first,代码行数:18,代码来源:stack+using+2+qs.cpp


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